📅  最后修改于: 2023-12-03 15:02:11.084000             🧑  作者: Mango
jQuery Mobile 工具栏 hide() 方法用于隐藏工具栏。
$( ".ui-toolbar" ).toolbar( "hide" );
无
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery Mobile 工具栏 hide() 方法示例</title>
<link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
</head>
<body>
<div data-role="page">
<div data-role="header" data-position="fixed">
<h1>头部</h1>
</div>
<div data-role="content">
<p>点击下面的按钮隐藏头部。</p>
<a href="#" class="ui-btn ui-corner-all ui-shadow" id="hide-header">隐藏头部</a>
</div>
<div data-role="footer" data-position="fixed">
<h1>尾部</h1>
</div>
</div>
<script>
$( "#hide-header" ).click(function() {
$( ".ui-header" ).toolbar( "hide" );
});
</script>
</body>
</html>
在上面的示例中,点击按钮会触发 click 事件。click 事件会调用 hide() 方法来隐藏头部。
$( "#hide-header" ).click(function() {
$( ".ui-header" ).toolbar( "hide" );
});
jQuery Mobile 工具栏 hide() 方法可用于隐藏工具栏。