jQuery Mobile Listview filterTheme选项

jQuery Mobile Listview filterTheme选项

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

在这篇文章中,我们将使用jQuery Mobile Listview filterTheme 选项。该选项设置了从色板到搜索栏的颜色方案,我们通过Listview的过滤器选项得到。这些颜色来自于我们的主题中所包含的颜色。

语法 。对于设置列表视图的filterTheme选项,使用以下语法。filterTheme需要一个a-z的单个字符作为参数,其中每个字符指定某种的颜色。

对于filterTheme选项的初始化,使用以下语法

$(".items").listview({
    filterTheme:"a",
});
  • 获取filterTheme选项。
var filterThemeOption = 
        $(".items").listview( "option", "filterTheme" );
  • 设置filterTheme选项。
$(".items").listview( "option", "filterTheme", "b" );

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>

例子1 。我们通过使用字符“b“为列表视图的过滤器主题选项,将主题设置为黑暗

<!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>
    <h1 style="color:green">
        GeeksforGeeks
    </h1>
    <h3>jQuery Mobile Listview filterTheme Option</h3>
    <ul class="items" data-filter-theme="b">
        <li>
            <a href=
"https://www.geeksforgeeks.org/data-structures" 
               target="_blank">
                Data Structures
            </a>
        </li>
        <li>
            <a href=
"https://practice.geeksforgeeks.org/courses/complete-interview-preparation" 
               target="_blank">
                Interview preparation
            </a>
        </li>
        <li>
            <a href=
"https://www.geeksforgeeks.org/java" 
               target="_blank">
                Java Programming
            </a>
        </li>
    </ul>
    <script>
    $(".items").listview({
        filter: true,
        filterTheme: "b",
    });
    </script>
</body>
  
</html>

输出

jQuery Mobile Listview filterTheme选项

例子2 :通过设置filterTheme“a “来使用light主题

<!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>
    <h1 style="color:green">
        GeeksforGeeks
    </h1>
    <h3>jQuery Mobile Listview filterTheme Option</h3>
    <ul class="items" data-filter-theme="a">
        <li>
            <a href=
"https://www.geeksforgeeks.org/data-structures" 
                target="_blank">
                Data Structures
            </a>
        </li>
        <li>
            <a href=
"https://practice.geeksforgeeks.org/courses/complete-interview-preparation" 
                target="_blank">
                Interview preparation
            </a>
        </li>
        <li>
            <a href=
"https://www.geeksforgeeks.org/java" 
               target="_blank">
                Java Programming
            </a>
        </li>
    </ul>
    <script>
    $(".items").listview({
        filter: true,
        filterTheme: "a",
    });
    </script>
</body>
  
</html>

输出

jQuery Mobile Listview filterTheme选项

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程