jQuery Mobile Toolbar enable()方法

jQuery Mobile Toolbar enable()方法

jQuery Mobile是一套基于HTML5的用户系统交互widget工具箱,用于各种用途,建立在jQuery之上。它被设计用来建立快速和响应性的网站,可用于手机、标签和桌面。

在这篇文章中,我们将使用jQuery Mobile Toolbar enable()方法来启用显示的工具条。

语法:

$(".selector").toolbar("enable");

参数:该方法不接受任何参数。

返回类型 。该方法返回一个对象值。

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 enable()方法。

<!DOCTYPE html>
<html lang="en">
  
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content=
        "IE=edge">
    <meta name="viewport" 
          content="width=device-width, initial-scale=1.0">
  
    <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>
</head>
  
<body>
    <div data-role="page">
        <center>
            <h1 style="color:green;">
                GeeksforGeeks
            </h1>
            <h3>jQuery Mobile Toolbar enable() method</h3>
            <div id="headerID" data-role="header">
                <h1>This is a header toolbar</h1>
            </div>
            <input type="button" id="Button" value="Enable toolbar">
            <div id="log"></div>
        </center>
    </div>
    <script>
        (document).ready(function () {
            ("#headerID").toolbar("disable");
            ("#Button").on('click', function () {
                ("#headerID").toolbar("enable");
                $("#log").html("Toolbar enabled!");
            });
        });
    </script>
</body>
  
</html>

输出:

jQuery Mobile Toolbar enable()方法

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程