Advertisement
srikat

isotope_init.js

Jul 31st, 2013
1,384
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. jQuery(function($){
  2.     $(window).load(function() {
  3.  
  4.             /*main function*/
  5.             function wpexPortfolioIsotope() {
  6.                 var $container = $('.portfolio-content');
  7.                 $container.imagesLoaded(function(){
  8.                     $container.isotope({
  9.                         itemSelector: '.portfolio-item'
  10.                     });
  11.                 });
  12.             } wpexPortfolioIsotope();
  13.  
  14.             /*filter*/
  15.             $('.filter a').click(function(){
  16.               var selector = $(this).attr('data-filter');
  17.                 $('.portfolio-content').isotope({ filter: selector });
  18.                 $(this).parents('ul').find('a').removeClass('active');
  19.                 $(this).addClass('active');
  20.               return false;
  21.             });
  22.  
  23.             /*resize*/
  24.             var isIE8 = $.browser.msie && +$.browser.version === 8;
  25.             if (isIE8) {
  26.                 document.body.onresize = function () {
  27.                     wpexPortfolioIsotope();
  28.                 };
  29.             } else {
  30.                 $(window).resize(function () {
  31.                     wpexPortfolioIsotope();
  32.                 });
  33.             }
  34.  
  35.             // Orientation change
  36.             window.addEventListener("orientationchange", function() {
  37.                 wpexPortfolioIsotope();
  38.             });
  39.  
  40.     });
  41. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement