Basic List

Description

jQuery Mobile can enhance any native HTML list, <ul> or <ol>, into a mobile optimized view when we add the data-role="list" attribute to our list element.

The enhanced list will display edge-to-edge by default.

If our list items contain links, they will be displayed as touch-friendly buttons with a right-aligned arrow icon.

By default, lists will be styled with the "c" swatch (gray) color. To apply an alternate theme, add the data-theme attribute to the list element or list items (<li>).

Example


<!DOCTYPE html>
<html>
<head>
<meta name="viewport"
  content="width=device-width, minimum-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet"
  href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script>
</head><!--   www . j  ava2  s  . c  o  m-->
<body>

  <div data-role="page">
    <div data-role="header">
      <h1>Genres</h1>
    </div>

    <div data-role="content">
      <ul data-role="listview" data-theme="c">
        <li><a href="#">Action</a></li>
        <li><a href="#">Adventure</a></li>
        <li><a href="#">Comedy</a></li>
        <li><a href="#">Drama</a></li>
        <li><a href="#">Fantasy</a></li>
        <li><a href="#">Horror</a></li>
        <li><a href="#">Romance</a></li>
        <li><a href="#">Science Fiction</a></li>
        <li><a href="#">Thriller</a></li>
      </ul>
    </div>
  </div>

</body>
</html>

Click to view the demo





















Home »
  jQuery Mobile »
    Tutorial »




jQuery_Mobile
Form
List
Layout
Theme