/* MINI Detections */ $('html').removeClass('no-js').addClass('js'); function is_touch_device() { return !!('ontouchstart' in window); } if(is_touch_device()) { $('html').addClass('touch'); } else { $('html').addClass('no-touch'); } function heights(){ var screenHeight = window.innerHeight; var headerHeight = screenHeight / 3; var navHeight = $('nav').outerHeight() * 2.5; $('section').css({'min-height':screenHeight}); $('.imagewrap').css({'height':screenHeight}); $('.text').css({'min-height':screenHeight}); $('.gradient').css({'height':navHeight}); }; $('a[href*=\\#]').smoothScroll({ easing: 'easeInOutExpo', speed:'auto', autoCoefficient: 2, preventDefault: true, afterScroll: function(options) { setTimeout(function(){ var trg = $(options.scrollTarget).find('.text'); $.smoothScroll({ scrollTarget: trg, easing: 'easeInOutExpo', speed:'auto', autoCoefficient: 2 }); },500); } }); $('.foto-wrap').mgSpace(); // Load content after click $('.foto-wrap').on('afterOpenTarget', function (event, mgSpace, element) { setTimeout(function () { $galEl = $('.mg-target-open').find('.load'); $galContent = $('.mg-target-open').find('.load').attr('data-content'); $galEl.html($galContent); console.log('Done'); }, 300); }); $(window).load(function(){ setTimeout(function(){ $('.loader').addClass('animated').addClass('fadeOut'); $('nav').addClass('animated').addClass('fadeIn'); $('section').addClass('animated').addClass('fadeIn'); },1000); }); $(document).ready(function(){ heights(); $('.navtoggle').on('click', function() { $(this).find('i').toggleClass('fa-times').toggleClass('fa-bars'); $('nav .mobile ul').slideToggle(); $('.nav-overlay').fadeToggle(); }); $('nav .mobile ul li a, .nav-overlay').not($('.lang, #volume-mobile, #volume')).on('click', function() { $('.navtoggle').trigger('click'); }); if ( window.innerWidth >= '1024' && !$('html').hasClass("touch") ){ //.parallax(xPosition, speedFactor, outerHeight) options: //xPosition - Horizontal position of the element //inertia - speed to move relative to vertical scroll. Example: 0.1 is one tenth the speed of scrolling, 2 is twice the speed of scrolling //outerHeight (true/false) - Whether or not jQuery should use it's outerHeight option to determine when a section is in the viewport $('#events .imagewrap').parallax("50%", 0.4); $('#ueber_uns .imagewrap').parallax("50%", 0.4); $('#partner .imagewrap').parallax("50%", 0.4); $('#fotos .imagewrap').parallax("50%", 0.4); //$('#faq .imagewrap').parallax("50%", 0.4); }; }); /* doc.rdy end */ $(function() { var sections = $('section'); var navigation_links = $('nav ul.main a'); sections.waypoint({ handler: function(direction) { var active_section; active_section = $(this); if (direction === "up") active_section = active_section.prev(); if (active_section.attr("id") == 'events' && direction === "down"){ $('#volume').trigger('click'); $('#start .imagewrap, #start .slideshow, #player').animate({'opacity':0}); } if (active_section.attr("id") == 'start' && direction === "up"){ $('#volume').trigger('click'); $('#start .imagewrap, #start .slideshow, #player').animate({'opacity':1}); } var active_link = $('nav a[href="#' + active_section.attr("id") + '"]'); navigation_links.removeClass("active"); active_link.addClass("active"); }, offset: '35%' }); }); $('[data-fancybox]').fancybox({ buttons : [ //'slideShow', //'fullScreen', 'thumbs', //'share', 'download', 'zoom', 'close' ], thumbs : { autoStart : true }, }); // Listen for resize changes window.addEventListener("resize", function() { heights(); }, false); // Listen for orientation changes window.addEventListener("orientationchange", function() { heights(); }, false);