/* Projection by TEMPLATED templated.co @templatedco Released for free under the Creative Commons Attribution 3.0 license (templated.co/license) */ (function($) { // Breakpoints. skel.breakpoints({ xlarge: '(max-width: 1680px)', large: '(max-width: 1280px)', medium: '(max-width: 980px)', small: '(max-width: 736px)', xsmall: '(max-width: 480px)' }); $(function() { var $window = $(window), $body = $('body'); // Disable animations/transitions until the page has loaded. $body.addClass('is-loading'); $window.on('load', function() { window.setTimeout(function() { $body.removeClass('is-loading'); }, 100); }); // Prioritize "important" elements on medium. skel.on('+medium -medium', function() { $.prioritize( '.important\\28 medium\\29', skel.breakpoint('medium').active ); }); // Off-Canvas Navigation. // Navigation Panel. $( '' ) .appendTo($body) .panel({ delay: 500, hideOnClick: true, hideOnSwipe: true, resetScroll: true, resetForms: true, side: 'left' }); // Fix: Remove transitions on WP<10 (poor/buggy performance). if (skel.vars.os == 'wp' && skel.vars.osVersion < 10) $('#navPanel') .css('transition', 'none'); }); })(jQuery); $( document ).ready(function() { // When the user scrolls down 20px from the top of the document, show the button window.onscroll = function() {scrollFunction()}; function scrollFunction() { if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) { document.getElementById("scrolltop").style.display = "block"; } else { document.getElementById("scrolltop").style.display = "none"; } } $("#scrolltop").on("click", function() { $('html, body').animate( { scrollTop: $('html').offset().top }, 'fast' ); }); $(".btn-bar").removeClass("disabled"); $(".galerie").addClass("galerie-mask"); function cardWidth() { return $('.galerie .card:first').outerWidth(true) } function updateScrollArrow() { if ($('.galerie').scrollLeft() == 0) { $('#realisations header .btn-left').addClass("disabled"); }else{ $('#realisations header .btn-left').removeClass("disabled"); } if (($('.galerie').scrollLeft() + $('.galerie').width() + 5) >= (cardWidth() * $('.galerie').children(".card").length)) { $('#realisations header .btn-right').addClass("disabled"); }else{ $('#realisations header .btn-right').removeClass("disabled"); } } $("#realisations header .btn-left").on("click", function() { $('.galerie').animate({ scrollLeft: "-=" + cardWidth() + "px" }, "fast", function(){ updateScrollArrow(); }); }); $("#realisations header .btn-right").on("click", function() { $('.galerie').animate({ scrollLeft: "+=" + cardWidth() + "px" }, "fast", function(){ updateScrollArrow(); }); }); $(window).resize(function() { $(".galerie").scrollLeft(0); updateScrollArrow(); }); updateScrollArrow(); $('.scroll').on('click', function() { var page = $(this).attr('href'); $('html, body').animate( { scrollTop: $(page).offset().top }, 'fast' ); return false; }); $('.galerie img').on('click', function() { var card = $(this).closest('.card'); var img = $(this); var caption = card.find('p'); console.log(caption.html()); var modal = $("#img-modal"); modal.find('img').attr("src",img.attr("src")); modal.find('.caption').html(caption.html()); modal.show(); $("#scrolltop").hide(); }); $('#img-modal').on('click', '.close', function() { $("#img-modal").hide(); $("#scrolltop").show(); }); });