我是 jQuery Mobile 的新手。我需要在我的应用程序中添加 Facebook 滑动面板功能。
我使用了滑动菜单面板,它工作正常,但是我在菜单面板中的内容超出了窗口大小,我想让它可以滚动。
请告诉我如何解决它。
代码参考
<!DOCTYPE html>
<html>
<head>
<title>FB Style Menu</title>
<meta id="extViewportMeta" name="viewport"content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
<style>
.ui-panel-inner {
overflow: hidden !important;
padding: 0px;
}
.ui-controlgroup {
margin: 0;
}
#header {
height: 54px;
}
#bars-button {
margin: 7px;
}
.panel-content {
overflow-y: scroll !important
}
</style>
<script>
$(document).on('pageshow', '#home', function(event) {
alert("init");
init(); //$.mobile.hidePageLoadingMsg();
});
function init() {
var header = $('[data-role=header]').outerHeight();
var panel = $('.ui-panel').height();
var panelheight = panel - header;
$('.ui-panel').css({
'top' : header,
'min-height' : panelheight
});
}
</script>
</head>
<body>
<div data-role="page" id="home" data-theme="b">
<div data-role="panel" id="navpanel" data-theme="a" data-display="overlay" data-position="right">
<div class="panel-content">
<div data-role="controlgroup" data-corners="false"> <a href="#" data-role="button">Business</a>
<a href="#" data-role="button">Numbers</a>
<a href="#" data-role="button">Money</a>
<a href="#" data-role="button">People</a>
<a href="#" data-role="button">Business</a>
<a href="#" data-role="button">Numbers</a>
<a href="#" data-role="button">Money</a>
<a href="#" data-role="button">People</a>
<a href="#" data-role="button">Business</a>
<a href="#" data-role="button">Numbers</a>
<a href="#" data-role="button">Money</a>
<a href="#" data-role="button">People</a>
</div>
</div>
</div>
<div id="header" data-role="header" data-theme="b">
<a id="bars-button" data-icon="bars" class="ui-btn-right" style="margin-top:10px;" href="#navpanel">Menu</a>
<!-- /About -->
</div>
</body>
</html>