Lists with Thumbnails and Icons

Description

We can add thumbnails to the left of our list item by adding an image inside a list item as the first child element.

The framework will scale the image to 80 pixels square.

Example


<!DOCTYPE html>
<html>
<head>
<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>
.tabbar .ui-btn .ui-btn-inner {<!--from  ww  w .ja v a 2  s .c  om-->
  font-size: 11px !important;
  padding-top: 24px !important;
  padding-bottom: 0px !important;
}
.tabbar .ui-btn .ui-icon {
  width: 30px !important;
  height: 20px !important;
  margin-left: -15px !important;
  box-shadow: none !important;
  -moz-box-shadow: none !important;
  -webkit-box-shadow: none !important;
  -webkit-border-radius: none !important;
  border-radius: none !important;
}

#home .ui-icon {
  background: url(http://placehold.it/50x50) 50% 50% no-repeat;
  background-size: 22px 20px;
}

#movies .ui-icon {
  background: url(http://placehold.it/50x50) 50% 50% no-repeat;
  background-size: 25px 17px;
}

#theatres .ui-icon {
  background: url(http://placehold.it/50x50) 50% 50% no-repeat;
  background-size: 20px 20px;
}

.segmented-control {
  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="header" data-theme="b" data-position="fixed">
      <div class="segmented-control ui-bar-d">
        <div data-role="controlgroup" data-type="horizontal">
          <a href="#" data-role="button" class="ui-control-active">In
            Theatres</a> 
          <a href="#" data-role="button"
            class="ui-control-inactive">Coming Soon</a> 
          <a href="#"
            data-role="button" class="ui-control-inactive">Top Rated</a>
        </div>
      </div>
    </div>

    <div data-role="content">
      <ul data-role="listview">
        <li><a href="#"> <img src="http://placehold.it/100x100" />
            <h3>Title 1</h3>
            <p>Rated: PG</p>
            <p>Runtime: 95 min.</p>
        </a></li>
        <li><a href="#"> <img src="http://placehold.it/100x100" />
            <h3>Title 2</h3>
            <p>Rated: PG-13</p>
            <p>Runtime: 137 min.</p>
        </a></li>
        <li><a href="#"> <img src="http://placehold.it/50x50" />
            <h3>Title 3</h3>
            <p>Rated: PG-13</p>
            <p>Runtime: 131 min.</p>
        </a></li>
      </ul>
    </div>
    <!-- tab bar with custom icons -->
    <div data-role="footer" class="tabbar" data-position="fixed">
      <div data-role="navbar" class="tabbar">
        <ul>
          <li><a href="#" id="home" data-icon="custom">Home</a></li>
          <li><a href="#" id="movies" data-icon="custom"
            class="ui-btn-active">Movies</a></li>
          <li><a href="#" id="theatres" data-icon="custom">Theatres</a></li>
        </ul>
      </div>
    </div>
  </div>
</body>
</html>

Click to view the demo





















Home »
  jQuery Mobile »
    Tutorial »




jQuery_Mobile
Form
List
Layout
Theme