jQuery Mobile Listview dividerTheme选项

jQuery Mobile Listview dividerTheme选项

jQuery Mobile是一个基于HTML5的用户界面系统,旨在使响应式网站和应用程序在所有智能手机、平板电脑和桌面设备上都能访问。 jQuery Listview是一个用于创建漂亮的列表的部件。它是一个简单和响应式的列表视图,用于查看**无序的列表。

在这篇文章中,我们将实现Listview的dividerTheme选项。dividerTheme 是应用于列表分割器的。列表分隔符是用来对列表项目进行分类或分组的。我们可以使用dividerTheme选项对列表分隔符应用不同的主题。

语法: listview的dividerTheme的语法如下。传递小写的a-z中的任何一个字母,每个字母描述一个主题。

$("#items").listview({
    dividerTheme: "a",
});

CDN链接:使用以下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-1.11.1.min.js”></script>
<script src=”https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js”></script>

例子1:在下面的例子中,我们为dividerTheme实现了light主题,绕开了字符’a’。

<!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-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>
    <h1>GeeksforGeeks</h1>
    <h3>jQuery Mobile Listview dividerTheme option</h3>
    <ul id="items" data-role="listview">
        <li data-role="list-divider">
            Data Structures
        </li>
  
        <li><a href=
"https://www.geeksforgeeks.org/array-data-structure">
                Arrays
            </a>
        </li>
          
        <li><a href=
"https://www.geeksforgeeks.org/data-structures/linked-list/">
                Linked List</a>
        </li>
  
        <li><a href=
"https://www.geeksforgeeks.org/stack-data-structure">
                Stack</a>
        </li>
  
        <li data-role="list-divider">
            Programming Languages
        </li>
  
        <li><a href=
"https://www.geeksforgeeks.org/c-programming-language">
                C</a>
        </li>
  
        <li><a href=
        "https://www.geeksforgeeks.org/c-plus-plus/">
                C++</a>
        </li>
        <li><a href="https://www.geeksforgeeks.org/java">
                Java</a></li>
    </ul>
      
    <script>
        $("#items").listview({
            dividerTheme: "a",
        });
    </script>
</body>
  
</html>

输出:

jQuery Mobile Listview dividerTheme选项

例子2:在这个例子中,我们通过实现字母“b “到列表视图的dividerTheme来使用黑暗主题。

<!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-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>
    <h1>GeeksforGeeks</h1>
    <h3>jQuery Mobile Listview dividerTheme option</h3>
  
    <ul id="items" data-role="listview">
        <li data-role="list-divider">
            Data Structures
        </li>
  
        <li><a href=
"https://www.geeksforgeeks.org/array-data-structure">
                Arrays
            </a>
        </li>
  
        <li><a href=
"https://www.geeksforgeeks.org/data-structures/linked-list/">
                Linked List</a>
        </li>
  
        <li><a href=
"https://www.geeksforgeeks.org/stack-data-structure">
                Stack</a>
        </li>
  
        <li data-role="list-divider">
            Programming Languages
        </li>
  
        <li><a href=
"https://www.geeksforgeeks.org/c-programming-language">
                C</a>
        </li>
  
        <li><a href=
"https://www.geeksforgeeks.org/c-plus-plus/">
                C++</a>
        </li>
          
        <li><a href="https://www.geeksforgeeks.org/java">
                Java</a>
        </li>
    </ul>
  
    <script>
        $("#items").listview({
            dividerTheme: "b",
        });
    </script>
</body>
  
</html>

输出:

jQuery Mobile Listview dividerTheme选项

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程