jquery移动内容高度在转换后更改+;奇怪的效果
我正在使用jquery mobile构建一个应用程序,在搜索了一些答案后,我可以创建100%高度的内容分区。。这是我的html代码和js:jquery移动内容高度在转换后更改+;奇怪的效果,jquery,html,css,jquery-mobile,Jquery,Html,Css,Jquery Mobile,我正在使用jquery mobile构建一个应用程序,在搜索了一些答案后,我可以创建100%高度的内容分区。。这是我的html代码和js: <body> <div data-role="page" id="page1"> <div data-role="header" data-position="fixed"> <h1>Page 1</h1> </div>
<body>
<div data-role="page" id="page1">
<div data-role="header" data-position="fixed">
<h1>Page 1</h1>
</div>
<div data-role="main" class="ui-content">
<a href="#page2" data-transition="slide" class="ui-btn ui-corner-all">Go to Page Two</a>
</div>
<div data-role="footer" data-position="fixed" data-id="myfooter">
<h1>Footer</h1>
</div>
</div>
<div data-role="page" id="page2">
<div data-role="header" data-position="fixed">
<h1>Page 2</h1>
</div>
<div data-role="main" class="ui-content">
<a href="#page1" data-transition="slide" data-direction="reverse" class="ui-btn ui-corner-all">Go back to Page 1</a>
</div>
<div data-role="footer" data-position="fixed" data-id="myfooter">
<h1>Footer</h1>
</div>
</div>
</body>
因此,在使用标签更改页面后,您可以看到滚动条出现,表明内容高度刚刚更改!我正在寻找一个100%高度的应用程序,可以在内容中添加更多标签(我不想为内容设置固定高度…),但在转换后,这种效果会发生在高度上。。jquery代码我做错什么了吗?我是jquery的新手,所以恐怕我做错了什么
此外,在过渡效果期间,您可以看到页脚的行为很奇怪,它改变了背景颜色,移动了几个像素。。是因为上一期吗
已经谢谢了,很抱歉英语不好
function contentHeight() {
var screen = $.mobile.getScreenHeight(),
header = $(".ui-header").outerHeight(),
footer = $(".ui-footer").outerHeight(),
contentCurrent = $(".ui-content").outerHeight() - $(".ui-content").height(),
content = screen - header - footer - contentCurrent;
$(".ui-content").height(content);
}
$(document).on("pagecontainertransition", contentHeight);
$(window).on("throttledresize orientationchange", contentHeight);