Advertisement
Guest User

Untitled

a guest
Sep 30th, 2014
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 5.06 KB | None | 0 0
  1. // Generated by CoffeeScript 1.6.3
  2. var isTouchDevice, scollDown;
  3.  
  4. $(function() {
  5.   var $c_carousel, $c_content, $c_wrapper, $container, extraWidth, id, itemWidth, offsetHeight, scrollPos, total;
  6.   offsetHeight = 50;
  7.   $('body').attr('data-spy', 'scroll');
  8.   $('body').attr('data-offset', offsetHeight);
  9.   $('body').attr('data-target', '#top-navbar-collapse-1');
  10.   if (window.location.href.indexOf('admin.') === "-1") {
  11.     $('#topbar .navbar').scrollspy({
  12.       offset: offsetHeight
  13.     });
  14.   }
  15.   if (window.location.hash) {
  16.     id = window.location.hash;
  17.     scrollPos = $("body").find(id).offset().top - offsetHeight;
  18.     $("#topbar a").each(function() {
  19.       if ($(this).attr('href') === id) {
  20.         return $(this).parent().addClass("active");
  21.       }
  22.     });
  23.     $("body, html").animate({
  24.       scrollTop: scrollPos
  25.     }, "fast");
  26.   }
  27.   $("a").each(function() {
  28.     var $this, link;
  29.     $this = $(this);
  30.     link = $this.attr('href');
  31.     if (link.indexOf("#") === 0 && link.length > 1) {
  32.       return $this.click(function() {
  33.         var element;
  34.         if ($this.parent().parent().hasClass('nav')) {
  35.           $("#topbar a").each(function() {
  36.             $(this).parent().removeClass("active");
  37.             if ($(this).attr("href").toString() === link && !$(this).hasClass("nav_phone")) {
  38.               return $(this).parent().addClass("active");
  39.             }
  40.           });
  41.         }
  42.         element = link.replace("/", "");
  43.         if (element === "#home") {
  44.           scrollPos = 0;
  45.         } else {
  46.           id = element;
  47.           scrollPos = $("body").find(id).offset().top - offsetHeight;
  48.         }
  49.         $("body, html").animate({
  50.           scrollTop: scrollPos
  51.         }, 500, function() {
  52.           if ($this.parent().parent().hasClass('nav')) {
  53.             return $(".btn-navbar").click();
  54.           }
  55.         });
  56.         window.location.hash = element;
  57.         if ($(window).width() < 768) {
  58.           if ($this.parent().parent().hasClass('nav')) {
  59.             $("button.navbar-toggle").click();
  60.           }
  61.         }
  62.         return false;
  63.       });
  64.     }
  65.   });
  66.   $("#home").parallax("center", 0.8);
  67.   if (window.location.pathname === "/") {
  68.     $("#klanten").parallax("center", 0.4);
  69.   }
  70.   $container = $('#klanten .customers');
  71.   if (!isTouchDevice()) {
  72.     $(".customers").elastislide();
  73.   }
  74.   if ($(window).width() > 640) {
  75.     $container.isotope({
  76.       itemPositionDataEnabled: true,
  77.       masonry: {
  78.         columnWidth: 175
  79.       },
  80.       resizesContainer: false
  81.     });
  82.     itemWidth = $container.find('.box').not('.active').width();
  83.     total = 1;
  84.     $container.find('.box').each(function() {
  85.       if ($(this).data('isotope-item-position').y >= 364) {
  86.         return total++;
  87.       }
  88.     });
  89.     extraWidth = ((total / 2) + 1) * (itemWidth + 10);
  90.     $container.width($container.width() + extraWidth);
  91.     setTimeout(function() {
  92.       return $container.isotope('reLayout');
  93.     }, 800);
  94.     $container.delegate('.box', 'click', function() {
  95.       var activeElement, containerWidth, newposition, position, totalFittingItems;
  96.       activeElement = $(this);
  97.       containerWidth = $container.width();
  98.       itemWidth = $container.find('.box').not('.active').outerWidth();
  99.       totalFittingItems = Math.floor(containerWidth / (itemWidth + 10));
  100.       position = activeElement.index();
  101.       $container.find('.box').each(function() {
  102.         var index;
  103.         index = $(this).index();
  104.         if (index <= position) {
  105.           if ($(this).hasClass('active')) {
  106.             totalFittingItems = totalFittingItems - 1;
  107.           }
  108.         }
  109.       });
  110.       $container.find('.box').filter('.active').removeClass('active');
  111.       activeElement.toggleClass('active');
  112.       if ((position + 1) > totalFittingItems) {
  113.         newposition = position - totalFittingItems;
  114.         $container.find('.box').eq(newposition).before(activeElement);
  115.       }
  116.       $container.isotope('reloadItems').isotope({
  117.         sortBy: 'original-order'
  118.       });
  119.       return $container.find('.box').each(function() {
  120.         var plus;
  121.         if ($(this).data('isotope-item-position').y === 0) {
  122.           plus = plus + $(this).width();
  123.         }
  124.         if ($(this).data('isotope-item-position').y >= 364) {
  125.           $container.width($container.width() + $(this).width() + 200);
  126.           return setTimeout(function() {
  127.             return $container.isotope('reLayout');
  128.           }, 800);
  129.         }
  130.       });
  131.     });
  132.   }
  133.   $c_carousel = $(".carousel");
  134.   $c_wrapper = $c_carousel.find(".customers_wrapper");
  135.   $c_content = $c_carousel.find(".customers");
  136.   if ($(window).width() <= 640) {
  137.     return $c_content.width(($c_carousel.find(".customer").outerWidth() + 40) * $c_carousel.find(".customer").size());
  138.   }
  139. });
  140.  
  141. scollDown = function() {
  142.   var scrollPos;
  143.   scrollPos = $("body").find('#organisatie').offset().top - 50;
  144.   return $("body, html").animate({
  145.     scrollTop: scrollPos
  146.   }, 500, function() {});
  147. };
  148.  
  149. isTouchDevice = function() {
  150.   return ('ontouchstart' in window) || ('onmsgesturechange' in window);
  151. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement