jQuery Mobile - Listview Autodivider Linkbar



Description

Linkbar extension is included for the autodivider linkbar listview. It adds a bar fixed at the right side of the screen, which helps to navigate to a specific part of listview very easily.

Example

Following example demonstrates the use of Listview Autodivider Linkbar in the jQuery Mobile.

<!DOCTYPE html>
<html>
   <head>
      <meta name = "viewport" content = "width = device-width, initial-scale = 1">
      <link rel = "stylesheet" href = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
      <link rel = "stylesheet" 
         href = " http://demos.jquerymobile.com/1.4.5/listview-autodividers-linkbar/autodividers-linkbar.css">
      <script src = "https://code.jquery.com/jquery-1.11.3.min.js"></script>
      <script src = "https://code.jquery.com/jquery-1.11.3.js"></script>
      <script src = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
      <script src = "http://demos.jquerymobile.com/1.4.5/listview-autodividers-linkbar/autodividers-linkbar.js"></script>
   </head>
   
   <body>
      <div data-role = "page" id = "demo-page">
         <div data-role  =  "header">
            <h2>Listview Autodivider Linkbar</h2>
            <a href = "#" class = "jqm-search-link ui-shadow ui-btn ui-btn-icon-notext 
               ui-corner-all ui-icon-search ui-nodisc-icon ui-alt-icon 
               ui-btn-right">Search</a>
         </div>
         
         <div role = "main" class = "ui-content">
            <div id = "sorter">
               <ul data-role = "listview">
                  <li><span>A</span></li>
                  <li><span>B</span></li>
                  <li><span>C</span></li>
                  <li><span>D</span></li>
                  <li><span>E</span></li>
                  <li><span>F</span></li>
                  <li><span>G</span></li>
                  <li><span>H</span></li>
               </ul>
            </div>
            
            <ul data-role = "listview" data-autodividers = "true" id = "sortedList">
               <li><a href = "#">Albania</a></li>
               <li><a href = "#">Algeria</a></li>
               <li><a href = "#">Angola</a></li>
               <li><a href = "#">Bahamas</a></li>
               <li><a href = "#">Barbados</a></li>
               <li><a href = "#">Belgium</a></li>
               <li><a href = "#">Canada</a></li>
               <li><a href = "#">Cameroon</a></li>
               <li><a href = "#">China</a></li>
               <li><a href = "#">Denmark</a></li>
               <li><a href = "#">Dominica</a></li>
               <li><a href = "#">Djibouti</a></li>
               <li><a href = "#">Ecuador</a></li>
               <li><a href = "#">Egypt</a></li>
               <li><a href = "#">Estonia</a></li>
               <li><a href = "#">Fiji</a></li>
               <li><a href = "#">Finland</a></li>
               <li><a href = "#">France</a></li>
               <li><a href = "#">Georgia</a></li>
               <li><a href = "#">Germany</a></li>
               <li><a href = "#">Greece</a></li>
               <li><a href = "#">Haiti</a></li>
               <li><a href = "#">Hong Kong</a></li>
               <li><a href = "#">Hungary</a></li>
            </ul>
         </div>
         
         <div data-role = "footer">
            <h4>Footer</h4>
         </div>
      </div>
   </body>
</html>

Output

Let's carry out the following steps to see how the above code works −

  • Save the above html code as listview_autodivider_linkbar.html file in your server root folder.

  • Open this HTML file as http://localhost/listview_autodivider_linkbar.html and the following output will be displayed.

jquery_mobile_widgets.htm
Advertisements