【发布时间】:2017-08-20 19:34:06
【问题描述】:
我有一个带有固定全屏工具栏的 jQuery Mobile 页面,其中启用了data-tap-toggle。
我在工具栏的正下方放置了一个横幅,当工具栏隐藏时它应该向上滑动,当工具栏显示时它应该向下滑动。
jQuery Mobile 通过应用和删除ui-fixed-hidden 类来切换toolbar - 遗憾的是,我在toolbar 小部件的文档中找不到任何toggle、hide 或show 事件那个。
我如何检测toolbar 何时切换以重新定位我的横幅?
.banner {
position: fixed;
background-color: darkseagreen;
top: 46px;
min-height: 48px;
width: 100%;
text-align: center;
line-height: 48px;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.css">
<script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
<script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.js"></script>
</head>
<body>
<div data-role="page" id="page-one">
<div data-theme="a" data-role="header" data-position="fixed" data-fullscreen="true">
<h1>First Page</h1>
</div>
<div data-role="content">
<div class="banner">call-to-action</div>
</div>
<div data-theme="a" data-role="footer" data-position="fixed" data-fullscreen="true">
<h3>Footer</h3>
</div>
</div>
</body>
</html>
【问题讨论】:
标签: javascript jquery jquery-mobile