Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Generated by CoffeeScript 1.6.3
- var isTouchDevice, scollDown;
- $(function() {
- var $c_carousel, $c_content, $c_wrapper, $container, extraWidth, id, itemWidth, offsetHeight, scrollPos, total;
- offsetHeight = 50;
- $('body').attr('data-spy', 'scroll');
- $('body').attr('data-offset', offsetHeight);
- $('body').attr('data-target', '#top-navbar-collapse-1');
- if (window.location.href.indexOf('admin.') === "-1") {
- $('#topbar .navbar').scrollspy({
- offset: offsetHeight
- });
- }
- if (window.location.hash) {
- id = window.location.hash;
- scrollPos = $("body").find(id).offset().top - offsetHeight;
- $("#topbar a").each(function() {
- if ($(this).attr('href') === id) {
- return $(this).parent().addClass("active");
- }
- });
- $("body, html").animate({
- scrollTop: scrollPos
- }, "fast");
- }
- $("a").each(function() {
- var $this, link;
- $this = $(this);
- link = $this.attr('href');
- if (link.indexOf("#") === 0 && link.length > 1) {
- return $this.click(function() {
- var element;
- if ($this.parent().parent().hasClass('nav')) {
- $("#topbar a").each(function() {
- $(this).parent().removeClass("active");
- if ($(this).attr("href").toString() === link && !$(this).hasClass("nav_phone")) {
- return $(this).parent().addClass("active");
- }
- });
- }
- element = link.replace("/", "");
- if (element === "#home") {
- scrollPos = 0;
- } else {
- id = element;
- scrollPos = $("body").find(id).offset().top - offsetHeight;
- }
- $("body, html").animate({
- scrollTop: scrollPos
- }, 500, function() {
- if ($this.parent().parent().hasClass('nav')) {
- return $(".btn-navbar").click();
- }
- });
- window.location.hash = element;
- if ($(window).width() < 768) {
- if ($this.parent().parent().hasClass('nav')) {
- $("button.navbar-toggle").click();
- }
- }
- return false;
- });
- }
- });
- $("#home").parallax("center", 0.8);
- if (window.location.pathname === "/") {
- $("#klanten").parallax("center", 0.4);
- }
- $container = $('#klanten .customers');
- if (!isTouchDevice()) {
- $(".customers").elastislide();
- }
- if ($(window).width() > 640) {
- $container.isotope({
- itemPositionDataEnabled: true,
- masonry: {
- columnWidth: 175
- },
- resizesContainer: false
- });
- itemWidth = $container.find('.box').not('.active').width();
- total = 1;
- $container.find('.box').each(function() {
- if ($(this).data('isotope-item-position').y >= 364) {
- return total++;
- }
- });
- extraWidth = ((total / 2) + 1) * (itemWidth + 10);
- $container.width($container.width() + extraWidth);
- setTimeout(function() {
- return $container.isotope('reLayout');
- }, 800);
- $container.delegate('.box', 'click', function() {
- var activeElement, containerWidth, newposition, position, totalFittingItems;
- activeElement = $(this);
- containerWidth = $container.width();
- itemWidth = $container.find('.box').not('.active').outerWidth();
- totalFittingItems = Math.floor(containerWidth / (itemWidth + 10));
- position = activeElement.index();
- $container.find('.box').each(function() {
- var index;
- index = $(this).index();
- if (index <= position) {
- if ($(this).hasClass('active')) {
- totalFittingItems = totalFittingItems - 1;
- }
- }
- });
- $container.find('.box').filter('.active').removeClass('active');
- activeElement.toggleClass('active');
- if ((position + 1) > totalFittingItems) {
- newposition = position - totalFittingItems;
- $container.find('.box').eq(newposition).before(activeElement);
- }
- $container.isotope('reloadItems').isotope({
- sortBy: 'original-order'
- });
- return $container.find('.box').each(function() {
- var plus;
- if ($(this).data('isotope-item-position').y === 0) {
- plus = plus + $(this).width();
- }
- if ($(this).data('isotope-item-position').y >= 364) {
- $container.width($container.width() + $(this).width() + 200);
- return setTimeout(function() {
- return $container.isotope('reLayout');
- }, 800);
- }
- });
- });
- }
- $c_carousel = $(".carousel");
- $c_wrapper = $c_carousel.find(".customers_wrapper");
- $c_content = $c_carousel.find(".customers");
- if ($(window).width() <= 640) {
- return $c_content.width(($c_carousel.find(".customer").outerWidth() + 40) * $c_carousel.find(".customer").size());
- }
- });
- scollDown = function() {
- var scrollPos;
- scrollPos = $("body").find('#organisatie').offset().top - 50;
- return $("body, html").animate({
- scrollTop: scrollPos
- }, 500, function() {});
- };
- isTouchDevice = function() {
- return ('ontouchstart' in window) || ('onmsgesturechange' in window);
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement