| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- /*
- 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.
- $(
- '<div id="navPanel">' +
- $('#nav').html() +
- '<a href="#navPanel" class="close"></a>' +
- '</div>'
- )
- .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();
- });
- });
|