如何使用javascript/jquery修复页眉和页脚

How to fix header and footer using javascript/jquery

本文关键字:何使用 javascript jquery      更新时间:2023-09-26

在我的iPhone和Android应用程序中,页眉和页脚不是固定的。当我专注于输入框时,页眉和页脚不会固定在它们的位置。他们离开了自己的位置并变得可滚动.目前我正在使用:

$("[data-role=header] [data-role=footer]").css("position", "fixed");

但它似乎不起作用。

任何建议都会有很大帮助。

试试这个

$("[data-role=header],[data-role=footer]").css("position", "fixed");

$("[data-role=header]").css("position", "fixed"); 
$("[data-role=footer]").css("position", "fixed");

尝试使用:

$("[data-role=header]").css("position", "fixed"); 
$("[data-role=footer]").css("position", "fixed");

或在两者之间添加,