$(document).foundation(); // Swiper Slider Congiguration // --------------------------- var swiper = new Swiper('.swiper-fullscreen', { effect: 'fade', loop: true, speed: 2000, autoplay: 5000, autoplayDisableOnInteraction: false }); var swipers = []; $('.swiper-square:not(.autoheight)').each(function(){ var swiper = new Swiper($(this), { pagination: '#'+this.id+' .swiper-pagination', paginationClickable: true, nextButton: '#'+this.id+' .swiper-button-next', prevButton: '#'+this.id+' .swiper-button-prev', loop: true }); swipers.push(swiper); }); $('.swiper-square.autoheight').each(function(){ var swiper = new Swiper($(this), { pagination: '#'+this.id+' .swiper-pagination', paginationClickable: true, nextButton: '#'+this.id+' .swiper-button-next', prevButton: '#'+this.id+' .swiper-button-prev', loop: true, breakpoints: { // when window width is <= 640px 640: { autoHeight: true }, } }); swipers.push(swiper); }); setTimeout(function() { $.each(swipers, function(k,v) { v.onResize(); }) }, 100); // Hamburger Animation // ------------------- (function() { "use strict"; var toggles = document.querySelectorAll(".c-hamburger"); for (var i = toggles.length - 1; i >= 0; i--) { var toggle = toggles[i]; toggleHandler(toggle); } function toggleHandler(toggle) { toggle.addEventListener("click", function(e) { e.preventDefault(); (this.classList.contains("is-active") === true) ? this.classList.remove("is-active"): this.classList.add("is-active"); }); } })(); // Object-Fit-Images // ----------------- $(function() { objectFitImages(); }); // Sticky Navigation // ----------------- $('.sticky').on('sticky.zf.stuckto:top', function() { $(this).addClass('animated slideInDown'); }).on('sticky.zf.unstuckfrom:top', function() { $(this).removeClass('animated slideInDown'); }); // Disables Scrolling of Body when Fullscreen Menu is open // ------------------------------------------------------- $("#fullscreen-trigger").click(function() { $("body").toggleClass("body-overflow"); }); // Fixed Mobile Book Now Button at the bottom of the page // ------------------------------------------------------ $(function() { $("#book-now-bottom").hide(); //hide your div initially $(window).scroll(function() { if ($(this).scrollTop() > 100) { $("#book-now-bottom:hidden").css('visibility', 'visible'); $("#book-now-bottom:hidden").fadeIn(''); } else { $("#book-now-bottom:visible").fadeOut(""); } }); }); // GMaps // ----- if (typeof GMaps !== 'undefined') { var map = new GMaps({ el: '#map', lat: -12.043333, lng: -77.028333 }); } // // init controller // var controller = new ScrollMagic.Controller(); // // // create a scene // var scene = new ScrollMagic.Scene({ // duration: 400, // the scene should last for a scroll distance of 100px // offset: 400 // start this scene after scrolling for 50px // }) // .setPin("#book-now") // pins the element for the the scene's duration // .addTo(controller); // assign the scene to the controller // --- Scrool Event --- // // // $(document).ready(function(){ // $(window).scroll(function() { // check if scroll event happened // if ($(document).scrollTop() > 800) { // check if user scrolled more than 800 from top of the browser window // $(".sticky-nav").addClass("animated slideInDown"); // if yes, then add class .animated and .slideInDown to .sticky-nav // } else { // $(".sticky-nav").removeClass("animated slideInDown"); // if not, remove those classes from .sticky-nav // } // }); // }); // // ---------------------------------- // // // --- Function to remove Class after Animation ends --- // // // $.fn.extend({ // animateCss: function (animationName) { // var animationEnd = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend'; // this.addClass('animated ' + animationName).one(animationEnd, function() { // $(this).removeClass('animated ' + animationName); // }); // } // }); // // // ---------------------------------- //