jQuery移动导航栏图标选项

jQuery移动导航栏图标选项

jQuery Mobile是一种基于网络的技术,旨在制作可在所有智能手机、平板电脑和桌面设备上访问的响应式网站和应用程序。

在这篇文章中,我们将学习jQuery Mobile导航栏的图标位置选项。iconpos选项要求定位导航栏项目的图标。

语法:iconpos选项**需要一个字符串输入,并且应该是上述类型之一。默认值是 “top”。

$("#gfgnavbar").navbar({
   iconpos: "right"
});

值:以下是该选项的值。

  • left。它将图标定位在文本的左边。
  • right。它将图标定位到文本的右边。
  • top。它将图标定位到文本的顶部。
  • bottom。它将图标定位到文本的底部。
  • none。图标不出现。
  • notext。只出现图标,不出现文字。

CDN链接:为jQuery Mobile项目使用以下CDN链接。

<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>

例子 。在下面的例子中,我们使用iconpos选项的” right “值将图标定位到_右边****。

<!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-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" id="gfgpage">
        <div data-role="header">
            <h1 style="color: green;">
                GeeksforGeeks
            </h1>
        </div>
        <div data-role="navbar" id="gfgnavbar">
            <ul>
                <li>
                    <a href="#one" data-icon="cloud">
                        One
                    </a>
                </li>
                <li>
                    <a href="#two" data-icon="star">
                        Two
                    </a>
                </li>
            </ul>
        </div>
        <div data-role="main" 
             class="ui-content">
            <h3>
              jQuery Mobile Navbar
              iconpos Option
            </h3>
        </div>
  
    </div>
    <script>
        $("#gfgnavbar").navbar({
            iconpos: "right"
        });
    </script>
</body>
  
</html>

输出:

jQuery移动导航栏图标选项

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程