// TRIGGER ANIMATIONS with WAYPOINT JS // http://www.oxygenna.com/tutorials/scroll-animations-using-waypoints-js-animate-css $(window).bind('load resize', function(){ function onScrollInit( items, trigger ) { items.each( function() { var osElement = $(this), osAnimationClass = osElement.attr('data-os-animation'), osAnimationDelay = osElement.attr('data-os-animation-delay'); osElement.css({ '-webkit-animation-delay': osAnimationDelay, '-moz-animation-delay': osAnimationDelay, '-ms-animation-delay': osAnimationDelay, 'animation-delay': osAnimationDelay }); var osTrigger = ( trigger ) ? trigger : osElement; osTrigger.waypoint(function() { osElement.addClass('animated').addClass(osAnimationClass); $('.slick-slide .os-animation').removeClass('fadeInUp animated'); $('.slick-active .os-animation').addClass('fadeInUp animated'); },{ triggerOnce: true, offset: '90%' }); }); } onScrollInit( $('.os-animation') ); }); $(document).ready(function(){ /* Windows Width Resize, Page Reload */ /*var tempWinWidth = $(window).width(); $(window).bind('resize', function(e){ if (window.RT) clearTimeout(window.RT); window.RT = setTimeout(function(){ var changes = ((tempWinWidth-$(window).width()) / tempWinWidth) ; if(changes < 0){ changes *= -1 } if(changes > 0.3){ window.location.reload(); } }, 100); });*/ //To trigger the # tag page anchor if(window.location.href.indexOf("#") > -1) { $(window).scrollTop(0); var topVal = 0; if($(window).width() > 767){ topVal = 90; } setTimeout(function(){ var target = $(location.hash); target = target.length ? target : $('[name=' + $(location).attr('hash').slice(1) + ']'); if (target.length) { $('html,body').animate({ scrollTop: target.offset().top - topVal }, 1000, "easeInOutCubic"); } }, 100); } /* For anchor link start with # */ $(document).on('click','a[href^=#]:not([href=#])',function (e) { e.preventDefault(); e.stopPropagation(); var target = $($(this).attr('href')); if(target.length){ $($(this).attr('href')).get(0).scrollIntoView({ behavior: "smooth", // or "auto" or "instant" block: "start" // or "end" }); } }); /* =========== BG Parallex Effect - BOF =========== */ if($(window).width() > 767){ var hWindow = $(window).height(); $(window).scroll(function () { var st = $(window).scrollTop(); $(".parallex-fixed .middle-bg, .wrapper_middle.parallex-fixed, .parallex-fixed").each(function(){ var otElement = $(this).offset().top - st; if( otElement > 0 && otElement < hWindow ){ sh = ((otElement / hWindow) * 50 ); } if(otElement <= 0){ sh=0; } if(otElement >= hWindow){ sh=50; } $(this).css({ // 'background-attachment' : 'fixed', 'background-position' : 'center '+sh+'% ' }); }); $(".parallex").each(function(){ var otElement = $(this).offset().top - st; if( otElement > 0 && otElement < hWindow ){ sh = 50 - ((otElement / hWindow) * 50); } if(otElement <= 0){ sh=50; } if(otElement >= hWindow){ sh=0; } //console.log('test: ' + otElement); $(this).css({ 'background-position' : 'center '+sh+'% ' }); }); /* Apply parallex BG on float element */ $(".parallex-parent").each(function(){ var otElement = $(this).offset().top - st; if( otElement > 0 && otElement < hWindow ){ sh = 50 - ((otElement / hWindow) * 50); } if(otElement <= 0){ sh=50; } if(otElement >= hWindow){ sh=0; } //console.log('test: ' + otElement); $(this).find('.middle-bg').css({ 'background-position' : 'center '+sh+'% ' }); }); $(".wrapper_middle.fixed, .fixed-bg").each(function(){ //$(this).css('background-position', 'center ' + (st-$(this).offset().top) + 'px'); //console.log('test: ' + ($(this).offset().top - st) ); /* Fixed iOS Safari background fixed CSS issue, by using position fixed in DIV element */ // if( ($(this).offset().top - st - $(window).height() ) < 20){ // }else if( ($(this).offset().top - st - ($(window).height()*1.1) ) > 0 || (st+$(window).height()*0.8) >= ($(window).height()*1.2 + $(this).offset().top) ){ $(this).removeClass('active'); }else{ $(this).addClass('active'); } }); }); } /* =========== EOF - BG Parallex Effect =========== */ /* Bootstrap Accordian */ $(document).on('click','.panel-group a.accordion-toggle',function(e){ $parentDIV = $(this).parents('div.panel-group'); if( $(this).hasClass('closed') ){ $('.panel-group#'+$parentDIV.attr('id')+' a.accordion-toggle').addClass('closed'); $('.panel-group#'+$parentDIV.attr('id')+' .panel-heading').removeClass('opened'); $(this).parent('.panel-heading').addClass('opened'); $(this).removeClass('closed'); setTimeout(function(){ //$('html').animate({ scrollTop: $('.panel-group#'+$parentDIV.attr('id')+' .panel-heading.opened').offset().top }, 300); },500); }else{ $('.panel-group#'+$parentDIV.attr('id')+' a.accordion-toggle').addClass('closed'); $(this).parent('.panel-heading').removeClass('opened'); } return true; }); /* EOF - Bootstrap Accordian */ // ------ Convert Thickbox to BlueImp ------- $(document).on('click', 'a.thickbox', function (event) { event.preventDefault(); var target = event.target || event.srcElement, link = target.src ? target.parentNode : target, dataindex = $(this).attr('data-index') ? $(this).attr('data-index') : link, options = { index: dataindex, event: event, onopened: function(){ /* === BOL - Panzoom jQuery plugin === */ $('#blueimp-gallery .slide').panzoom(); var zoomLevel = 1; // Panzoom with Mouse Scroll $('#blueimp-gallery .slide').on('wheel', function(e) { var oEvent = e.originalEvent, delta = oEvent.deltaY || oEvent.wheelDelta; var valX = parseInt($(this).css('transform').split(',')[4]); var valY = parseInt($(this).css('transform').split(',')[5]); if (delta < 0) { // Scrolled up || zoom in if(zoomLevel < 2 ) { zoomLevel = zoomLevel *1.1; } } else { // Scrolled down || zoom out if(zoomLevel > 0.3 ){ zoomLevel = zoomLevel *0.9; } } $(this).css('transform', 'matrix('+zoomLevel+', 0, 0,'+zoomLevel+', '+valX+','+valY+')'); return false; }); /* === EOL - Panzoom jQuery plugin === */ }, onclosed: function () { //console.log('test2'); $('body:not(.noscroll)').css({'overflow-y':'auto'}); } }; //fullScreen: true, //When no group ID detect if($(this).attr('rel') == null){ blueimp.Gallery($(this),options); }else{ blueimp.Gallery($('a.thickbox[rel='+$(this).attr('rel')+']'),options); } }); // ------ EOF - Convert Thickbox to BlueImp ------- /*----- EOF - Add 'back to top' button -----*/ /*--- BOF - Append Current Link to Anchor ---*/ var currentLoc = $(location).attr('href'); $("a[href^='#']").each(function(){ var hashValue = $(this).attr('href'); $(this).attr('href', currentLoc + hashValue); }); /*--- EOF - Append Current Link to Anchor ---*/ /* Stay to Bottom Footer */ $(window).height() < ($('#morph-main').height() + $('footer').height()) && $('footer').css({'position':'relative'}); /*----- BOF - Add 'back to top' button -----*/ $('body').prepend('
Touch Screen Device Detected ...
'); } /*================= EOF - Add Classname Touchscreen Detection into HTML ================= */