Split Button Lists

Description

To support multiple actions per list item, we can create a split button list that has a primary and secondary button to choose from.

To create a split button, add a secondary link inside the list item and the framework will add a vertical line dividing the primary and secondary actions.

To set the icon for all secondary buttons, add the data-split-icon attribute to the list element and set its value to a standard or custom icon.

By default, the secondary button will be styled with the "b" swatch (light blue) color. To apply an alternate theme, add the data-split-theme attribute to the list element.

Example


<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>List Example</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet"
  href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" />
<style>
.segmented-control {<!--from  w w w  . j  av a  2 s  .  co m-->
  text-align: center;
}

.segmented-control .ui-controlgroup {
  margin: 0.2em;
}

.ui-control-active, .ui-control-inactive {
  border-style: solid;
  border-color: gray;
}

.ui-control-active {
  background: #BBB;
}

.ui-control-inactive {
  background: #DDD;
}
</style>
<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>
<body>
  <div data-role="page">
    <div data-role="content">
      <ul data-role="listview" data-split-icon="star" data-split-theme="d">
        <li><a href="#"> <img src="http://placehold.it/50x50" />
            <h3>Action Movie</h3>
            <p>Rated: PG</p>
            <p>Runtime: 95 min.</p>
        </a> <a href="#">Buy Tickets</a></li>
        <li><a href="#"> <img src="http://placehold.it/50x50" />
            <h3>Pirates</h3>
            <p>Rated: PG-13</p>
            <p>Runtime: 137 min.</p>
        </a> <a href="#">Buy Tickets</a></li>
        <li><a href="#"> <img src="http://placehold.it/50x50" />
            <h3>X-Men</h3>
            <p>Rated: PG-13</p>
            <p>Runtime: 131 min.</p>
        </a> <a href="#">Buy Tickets</a></li>
        <li><a href="#"> <img src="http://placehold.it/50x50" />
            <h3>Kung Fu Panda 3D</h3>
            <p>Rated: PG</p>
            <p>Runtime: 95 min.</p>
        </a> <a href="#">Buy Tickets</a></li>
        <li><a href="#"> <img src="http://placehold.it/50x50" />
            <h3>X-Men 3D</h3>
            <p>Rated: PG-13</p>
            <p>Runtime: 131 min.</p>
        </a> <a href="#">Buy Tickets</a></li>
      </ul>
    </div>
  </div>

</body>
</html>

Click to view the demo





















Home »
  jQuery Mobile »
    Tutorial »




jQuery_Mobile
Form
List
Layout
Theme