/*----------------------------------------------------------------------------------- Script - All Custom frontend jQuery scripts & functions -----------------------------------------------------------------------------------*/ (function(){ 'use strict'; /* do animations if element is visible ------------------------------------------------*/ function animateOnScroll(pagestart) { /* portfolio animations */ if (jQuery('.portfolio-animation').length > 0) { jQuery('.portfolio-container.portfolio-animation .portfolio-item').not('.animated') .filter(function(i, d) { return jQuery(d).visible(true); }).each(function(i) { var thisItem = jQuery(this); //if (this) if (jQuery(window).width() > 1024 && !thisItem.hasClass( "animated" )) { var delay = i*120 + 100; // + 100 is to add a small delay if (pagestart && thisItem.data('startposition')) { delay = parseInt(thisItem.data('startposition')) * 200; } thisItem.delay(delay).queue(function(){thisItem.addClass('animated');}); } }); } /* hero-animation */ jQuery('#hero.hero-animation').not('.animated').addClass('animated'); /* text-animations */ if (jQuery('.text-animation').length > 0) { jQuery('.text-animation').not('.animated') .filter(function(i, d) { return jQuery(d).visible(true); }).each(function(i) { var thisItem = jQuery(this); if (jQuery(window).width() > 1024 && !thisItem.hasClass( "animated" )) { var delay = i*120 + 100; thisItem.delay(delay).queue(function(){thisItem.addClass('animated');}); } }); } /* text-animations */ if (jQuery("[class*='do-anim']").length > 0) { jQuery("[class*='do-anim']").not('.animated') .filter(function(i, d) { return jQuery(d).visible(true); }).each(function(i) { var thisItem = jQuery(this); var delay = i*120 + 100; // + 150 is to add a small delay thisItem.delay(delay).queue(function(){thisItem.addClass('animated');}); }); } /*从下到上*/ if (jQuery("[class*='bianq']").length > 0) { jQuery("[class*='bianq']").not('.animated') .filter(function(i, d) { return jQuery(d).visible(true); }).each(function(i) { var thisItem = jQuery(this); var delay = i*120 + 100; thisItem.delay(delay).queue(function(){thisItem.addClass('animated');}); }); } // 返回 if (jQuery("[class*='wen']").length > 0) { jQuery("[class*='wen']").not('.animated') .filter(function(i, d) { return jQuery(d).visible(true); }).each(function(i) { var thisItem = jQuery(this); var delay = i*120 + 100; thisItem.delay(delay).queue(function(){thisItem.addClass('animated');}); }); } /*从左到右*/ if (jQuery("[class*='wen']").length > 0) { jQuery("[class*='wen']").not('.animated') .filter(function(i, d) { return jQuery(d).visible(true); }).each(function(i) { var thisItem = jQuery(this); var delay = i*120 + 100; thisItem.delay(delay).queue(function(){thisItem.addClass('animated');}); }); } /*从上到下*/ if (jQuery("[class*='s-xia']").length > 0) { jQuery("[class*='s-xia']").not('.animated') .filter(function(i, d) { return jQuery(d).visible(true); }).each(function(i) { var thisItem = jQuery(this); var delay = i*120 + 100; thisItem.delay(delay).queue(function(){thisItem.addClass('animated');}); }); } /*从右到左*/ if (jQuery("[class*='y-zuo']").length > 0) { jQuery("[class*='y-zuo']").not('.animated') .filter(function(i, d) { return jQuery(d).visible(true); }).each(function(i) { var thisItem = jQuery(this); var delay = i*120 + 100; thisItem.delay(delay).queue(function(){thisItem.addClass('animated');}); }); } /*宽度变化*/ if (jQuery("[class*='z-xuan']").length > 0) { jQuery("[class*='z-xuan']").not('.animated') .filter(function(i, d) { return jQuery(d).visible(true); }).each(function(i) { var thisItem = jQuery(this); var delay = i*120 + 100; thisItem.delay(delay).queue(function(){thisItem.addClass('animated');}); }); } /* infinite Load for isotope */ if( jQuery().isotope ) { jQuery(".load-isotope:not(.loading):not(.disabled) > a[data-method='infiniteload']") .filter(function(i, d) { return jQuery(d).visible(false); }).each(function() { console.log("visible"); jQuery(this).trigger( "click" ); }); } } jQuery(window).load(function() { if(jQuery().lightcase) { jQuery('a[data-rel^=lightcase]').lightcase({ showSequenceInfo: false, swipe: true, showCaption:false, overlayOpacity:0.95, maxWidth: 1300, maxHeight: 1100, shrinkFactor: 1, liveResize: true, fullScreenModeForMobile: true, video: { width : 854, height : 480 }, iframe:{ width:854, height:480, allowfullscreen: 1 } }); } if(jQuery().revolution) { jQuery("#hero .revolution-slider").revolution({ sliderType:"standard", sliderLayout:"fullscreen", fullScreenAutoWidth:"on", fullScreenOffsetContainer:"#pseudo-header", delay:9000, disableProgressBar:'on', navigation: { arrows:{ enable:true, style:"dani-nav", left:{ h_offset: 25 }, right:{ h_offset: 25 } }, bullets:{ enable:false, style:"dani-bullets", h_align:"center", v_align:"bottom", h_offset:0, v_offset:25, space:7, }, touch:{ touchenabled:"on", swipe_treshold : 75, swipe_min_touches : 1, drag_block_vertical:false, swipe_direction:"horizontal" } }, responsiveLevels:[2048,1360,1100,780], gridwidth:[1100,880,680,400], gridheight:[700,550,550,450], lazyType: 'smart' }); } }); jQuery(window).scroll(function() { animateOnScroll(false); }); jQuery(window).resize(function() { }); })(jQuery);