jQuery Mobile Toolbar hide()方法
jQuery Mobile是一套基于HTML5的用户系统交互widget工具箱,用于各种用途,建立在jQuery之上。它被设计用来建立快速和响应性的网站,可用于手机、标签和桌面。
在这篇文章中,我们将使用jQuery Mobile Toolbar hide()方法来隐藏一个工具条。这个方法不接受任何参数。
语法:
$(".selector").toolbar("hide");
参数:该方法不接受任何参数。
CDN链接:要使用jQuery Mobile,我们首先要把它添加到项目中。
<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-2.1.3.js”></script> _
<script src=”https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.js”></script>
例子:这个例子描述了jQuery Mobile Toolbar hide()方法。
<!DOCTYPE html>
<html lang="en">
<head>
<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-2.1.3.js">
</script>
<script src=
"https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.js">
</script>
<script>
function hide() {
$("#GFG").toolbar("hide");
}
</script>
</head>
<body>
<div data-role="page">
<center>
<h2>GeeksForGeeks</h2>
<h3>jQuery Mobile Toolbar hide() method</h3>
</center>
<div id="GFG" data-role="header">
<h1>Page Title</h1>
</div>
<button onclick="hide();">Hide ToolBar</button>
</div>
</body>
</html>
输出:

极客教程