RUSSEL86

Isotom setup demo

Dec 5th, 2016
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 3.27 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <title>Demo ISOTOPE</title>
  6.    
  7.    
  8.     <style type="text/css">
  9.     body {
  10.     margin: 0;
  11.     padding: 0;
  12. }
  13. .wraper {
  14.     width: 90%;
  15.     margin: 10px auto;
  16. }
  17. /****** Navigation styling *******/
  18. .iso-nav {
  19.     text-align: center;
  20. }
  21. ul  li {
  22.     list-style: none;
  23.     margin: 0;
  24.     padding: 0;
  25.     display: inline-block;
  26.     padding: 10px 15px;
  27.     border: 1px solid #5274a9;
  28.     cursor: pointer;
  29.     -webkit-transition: all .5s ease;
  30.     -moz-transition: all .5s ease;
  31.     -ms-transition: all .5s ease;
  32.     transition: all .5s ease;
  33. }
  34. ul  li:hover {
  35.     background: #5274a9;
  36.     color: #fff;
  37. }
  38. /****** Main portfilio styling ********/
  39.  
  40. .main-iso {
  41.     width: 100%;
  42.    
  43. }
  44. .main-iso .item {
  45.     width: 303px;
  46.     float: left;
  47.     margin-bottom: 10px;
  48. }
  49.  
  50. .active {
  51.     background: #5274a9;
  52.     color: #fff;
  53. }
  54.  
  55.     </style>
  56. </head>
  57. <body>
  58.     <div class="wraper">
  59.         <div class="iso-nav">
  60.             <ul>
  61.                 <li class="active" data-filter="*">All Items</li>
  62.                 <li data-filter=".web">Web Design</li>
  63.                 <li data-filter=".graphic">Graphic Design</li>
  64.                 <li data-filter=".photo">Photography</li>
  65.             </ul>
  66.         </div>
  67.         <div class="main-iso">
  68.             <div class="item web">
  69.                 <img src="img/image_1.jpg" alt="">
  70.             </div>
  71.             <div class="item graphic">
  72.                 <img src="img/image_2.jpg" alt="">
  73.             </div>
  74.             <div class="item photo">
  75.                 <img src="img/image_1.jpg" alt="">
  76.             </div>
  77.             <div class="item">
  78.                 <img src="img/image_2.jpg" alt="">
  79.             </div>
  80.             <div class="item web">
  81.                 <img src="img/image_1.jpg" alt="">
  82.             </div>
  83.             <div class="item web">
  84.                 <img src="img/image_2.jpg" alt="">
  85.             </div>
  86.             <div class="item graphic">
  87.                 <img src="img/image_1.jpg" alt="">
  88.             </div>
  89.             <div class="item photo">
  90.                 <img src="img/image_2.jpg" alt="">
  91.             </div>
  92.         </div>
  93.     </div>
  94.    
  95.    
  96. <!--    Javascript files are here... -->
  97. <!--Jquery CDN -->
  98. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
  99. <!--isotope here...-->
  100. <script src="'//cdnjs.cloudflare.com/ajax/libs/jquery.isotope/3.0.6/isotope.pkgd.min.js"></script>
  101. <!--isotope image messedup...
  102. <script src="//unpkg.com/imagesloaded@4/imagesloaded.pkgd.min.js"></script>-->
  103. <!--Custom Js file here ... -->
  104. <script type="text/javascript">
  105. //Isotope active js code:
  106. //************************
  107.  
  108. // Active isotope with jQuery code:
  109.  
  110. $('.main-iso').isotope({
  111.     itemSelector: '.item',
  112.     layoutMode: 'fitRows'
  113. });
  114. <!--If isotope image messedup...-->
  115. /*$('.container').imagesLoaded( function() {
  116.     $('.main-iso').isotope({
  117.         itemSelector: '.item',
  118.         layoutMode: 'fitRows'      
  119.     });
  120. });*/
  121. // Isotope click function
  122. $('.iso-nav ul li').click(function(){
  123.     $('.iso-nav ul li').removeClass('active');
  124.     $(this).addClass('active');
  125.  
  126.     var selector = $(this).attr('data-filter');
  127.     $('.main-iso').isotope({
  128.         filter: selector
  129.     });
  130.     return false;
  131. });
  132.  
  133. </script>
  134. </body>
  135. </html>
Advertisement
Add Comment
Please, Sign In to add comment