// When Window Loaded. $(window).on('load', function() { 'use strict'; //********************************************* // MOBILE & BROWSER DETECTERS //********************************************* // Control of the functions exists $.fn.exists = function () { return this.length > 0; }; // Check the device for mobile or desktop if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || $(window).width() < 769 ) { var mobile = true; } else{ var mobile = false; } // Check the browsers // Opera 8.0+ var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0, // Firefox 1.0+ isFirefox = typeof InstallTrigger !== 'undefined', // Safari 3.0+ "[object HTMLElementConstructor]" isSafari = /constructor/i.test(window.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window['safari'] || safari.pushNotification), // Internet Explorer 6-11 isIE = /*@cc_on!@*/false || !!document.documentMode, // Edge 20+ isEdge = !isIE && !!window.StyleMedia, // Chrome 1+ isChrome = !!window.chrome && !!window.chrome.webstore, // Blink engine detection isBlink = (isChrome || isOpera) && !!window.CSS, // Parallax effects for selected browsers isParallaxBrowsers = (isOpera || isFirefox || isBlink || isChrome); // Add .ite-browser class if browsing with internet explorer. if (isIE){ $("body").addClass("ie-browser"); } // If mobile device - DO ANYTHING FOR ONLY MOBILE if (mobile === true) { //Make scrollable parallax backgrounds $("[data-stellar-background-ratio]").addClass('bg-scroll cover'); $('.bg-parallax').addClass('bg-parallax-mobiled'); // Add/Remove class with hover if ($('#side-dotted-navigation').exists()){ var self = $('#side-dotted-navigation'); $('body section:not(.nav-menu), div').on('touch touchstart',function(){$(self).addClass('spy');}) $(self).on('touch touchstart touchend',function(){$(self).removeClass('spy');}) $('#side-dotted-navigation:not(".spy")').on('touch',function(){$(self).addClass('spy');}) } $('.hero-slider').height($(window).outerHeight()); //do something else for mobile devices // If not mobile device DO ANYTHING FOR ONLY DESKTOPS } else{ //Call Parallax Effect for background images $("[data-stellar-background-ratio], [data-stellar-ratio]").not('.bg-normal').addClass('parallax'); //Call Stellar.js for parallax effects if (isParallaxBrowsers) { $.stellar({ horizontalScrolling: false, verticalScrolling: true, horizontalOffset: 0, verticalOffset: 0, responsive: false, scrollProperty: 'scroll', positionProperty: 'transform', parallaxBackgrounds: true, parallaxElements: true, hideDistantElements: false }); } //Set the parallax items $('body').addClass('stable'); $(window).on("scroll", function(){ if($('body').hasClass('stable')){ //Refresh parallax effect setTimeout( function(){ if (isParallaxBrowsers) { var s = skrollr.init({ forceHeight: false }); s.refresh(); } }, 100); $(window).trigger("resize"); $('body').removeClass('stable'); } }); $('#extranav').ready(function(){ //Show and hide extra Navigation function showHideExtraNav() { var nowPos = $(window).scrollTop(); //Extra navigation variations var extranav = $('#extranav'), showExNav = extranav.attr('data-showme'), hideExNav = extranav.attr('data-hideme'); if ($(hideExNav).exists() && $(showExNav).exists()){ var showSection = $(showExNav).offset().top, hideSection = $(hideExNav).offset().top; if($(window).width() > 700){ if(nowPos >= showSection - 60 && nowPos <= hideSection - 60) {$(extranav).slideDown(150).removeClass('hiding'); } else{$(extranav).addClass('hiding').slideUp(150);} } } else { $(extranav).slideDown(150).removeClass('hiding').find('ul.nav').html('Extra Navigation is here! Please check the data-showme and data-hideme areas. This page does not have those links.'); } } $(window).on("scroll", function(){ showHideExtraNav(); }); }); //Ready skrollr effects if ( $('.skrollr').exists()) { var s = skrollr.init({ forceHeight: false }); } //Do something else for only large screen devices } //********************************************* // Detect Retina Screens and use retina logo //********************************************* //Detect retina screen type function isRetina(){ return ((window.matchMedia && (window.matchMedia('only screen and (min-resolution: 124dpi), only screen and (min-resolution: 1.3dppx), only screen and (min-resolution: 48.8dpcm)').matches || window.matchMedia('only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 2.6/2), only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (min-device-pixel-ratio: 1.3)').matches)) || (window.devicePixelRatio && window.devicePixelRatio > 1.3)); } //Add .retina-device class to body if the device is retina. And change images for retina screens if (isRetina()) { $("body").addClass("retina-device"); $("[data-retina-image]").each(function(){ var $this = $(this), $itemWidth = $(this).width(), $rtnIMG = $(this).attr("data-retina-image"); $(this).attr("src", $rtnIMG).css({"width": $itemWidth + "px"}); }); } //Add .has-retina-logo class to body if navigation has retina logo if ($(".retina-logo").exists()) { $("body").addClass("has-retina-logo"); } //********************************************* // QUADRA SPECIAL EFFECTS AND FEATURES //********************************************* //Get screen size of device $.fn.getDeviceWidth = function() { if ($(window).width() > 1200 ) { $('body').not('.device-xl').removeClass("device-lg device-md device-sm device-xs device-xxs").addClass('device-xl'); } if ($(window).width() > 992 && $(window).width() < 1200 ) { $('body').not('.device-lg').removeClass("device-xl device-lg device-md device-sm device-xs device-xxs").addClass('device-lg'); } if ($(window).width() > 768 && $(window).width() < 992 ) { $('body').not('.device-md').removeClass("device-xl device-lg device-md device-sm device-xs device-xxs").addClass('device-md'); } if ($(window).width() > 576 && $(window).width() < 768 ) { $('body').not('.device-sm').removeClass("device-xl device-lg device-md device-sm device-xs device-xxs").addClass('device-sm'); } if ($(window).width() > 480 && $(window).width() < 576 ) { $('body').not('.device-xs').removeClass("device-xl device-lg device-md device-sm device-xs device-xxs").addClass('device-xs'); } if ($(window).width() < 480 ) { $('body').not('.device-xxs').removeClass("device-xl device-lg device-md device-sm device-xs device-xxs").addClass('device-xxs'); } } $('body').getDeviceWidth(); //Put background images to mobile if ($(window).width() < 769 ) { $("[data-mobile-background]").each(function(){var bgSRC = $(this).data('mobile-background'); $(this).addClass('bg-mobiled').css({'background-image': 'url(' + bgSRC + ')', 'background-size': 'cover !important'}); }); } //Lazy Load if ($("[data-original]").exists()){ $("[data-original]").lazyload({ threshold : 1000, load: function() { // Mobile if( mobile === false ){ if (isParallaxBrowsers) {$(window).data('plugin_stellar').refresh(); } } }, }); } //Play buttons for iframe videos if ($(".video-trigger").exists()){ $('.video-trigger').each(function(){ var target = $(this).find('iframe'), trigger = $(this).find('.video-play-trigger'), src = $(target).data('src'); $(trigger).on('click', function(ev) { $(target).attr('src', src); ev.preventDefault(); $(this).delay(200).fadeOut(500); }); }); } //Quadra Alert on page $('.qdr-alert-trigger').each(function(){ var self = $(this), target = $(self).data('target'), timer; $(self).on('click', function(){ clearTimeout(timer); $(target).fadeOut(0).stop().clearQueue(); setTimeout( function(){$(target).fadeIn(300)},1); timer = setTimeout( function(){$(target).fadeOut(300);},3000); }); }); //Stay Page $('.stay').on('click', function(e){ e.preventDefault(); }); //Cookie Modal close with checkbox var my_cookie = $.cookie($('.modal-check').attr('name')), cookieModal = $("#cookie-modal"); if (my_cookie && my_cookie == "true") { $(this).prop('checked', my_cookie); } else{ $(cookieModal).modal('show'); } $(".modal-check").change(function() { $.cookie($(this).attr("name"), $(this).prop('checked'), { path: '/', expires: 1 }); }); //Cookie Modal Classic if ($.cookie("no_thanks") == null && $("#cookie-alert").exists() || $("#cookie-modal").exists()) { // Show the modal, with delay func. $.fn.show_modal = function() { $('#cookie-alert').modal({backdrop: 'static', keyboard: false}); $('.modal-backdrop.show:not(.fade)').removeClass("modal-backdrop"); $('body').addClass('cookie-alert-active'); } // Set delay func. time in milliseconds setTimeout( function(){ $(window).show_modal(); },3000); } // On click of specified class (e.g. 'nothanks'), trigger cookie, which expires in 100 years $.fn.closeCookieAlert = function() { $.cookie('no_thanks', 'true', { expires: 1, path: '/' }); $('body').removeClass('cookie-alert-active'); $('#cookie-alert').hide(); } $("#cookie-alert .close").on('click', function() { $('body').closeCookieAlert(); }); $(document).keyup(function(e) {if (e.keyCode == 27) { $('body').closeCookieAlert(); } }); //Quadra Hovers; $('.qdr-hover').each(function(){ var qdrText = $(this).html(); $(this).empty(); $(this).append(""); $(this).find('span.qdr-details').html(qdrText); }); $('.qdr-hover-3').each(function(){ var qdrText = $(this).html(); $(this).empty(); $(this).append(""); $(this).find('span.qdr-details').html(qdrText); }); //Clearfix class for the boxes and cols $('.boxes').addClass('clearfix'); $('[class*="qdr-col-"]').addClass('clearfix'); //Add data-color option to everything, for example; data-color="#333" $("[data-color]").each(function(){var clrSRC = $(this).data('color'); $(this).css({'color': clrSRC}); }); $("[data-bgcolor]").not('.tp-bgimg').not('.rev-slidebg').each(function(){var clrSRC = $(this).data('bgcolor'); $(this).css({'background-color': clrSRC}); }); //QDR moving items if ($(".moving-container").exists()){ if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) {} else{ $(".moving-container").each(function(){ var selector = $(this).find('.moving'); $(this).hover3d({ selector: selector, shine: false, perspective:1500, sensitivity:85, invert:false }); }); } } //Mouse animation for portfolio images if ($(".styled-portfolio.parallax").exists()){ if ($(window).width() > 630) { $(".styled-portfolio.parallax .cbp-item").each(function(i, el) { $(this).on("mouseenter", function(e) { var currentX = '', currentY = '', movementConstant = 0.1; var item = $(this); $(item).mousemove(function(e) { if(currentX == '') currentX = e.pageX; var xdiff = e.pageX - currentX; currentX = e.pageX; if(currentY == '') currentY = e.pageY; var ydiff = e.pageY - currentY; currentY = e.pageY; $(item).find('.cbp-caption-defaultWrap').each(function(i, el) { var movement = (i + 1) * (xdiff * movementConstant), movementy = (i + 1) * (ydiff * movementConstant), newX = $(el).position().left + movement, newY = $(el).position().top + movementy; $(el).find('img').css({"-webkit-transform":"translate(" + newX + "px,"+ newY +"px) scale(1.06)"}); }); }); }); $(this).on("mouseleave", function(e) { $(this).find('img').css({"-webkit-transform":"translate(0px,0px) scale(1.0)"}); }); }); } } //Call fitvids if ($(".fitvids").exists()){ $(".fitvids").fitVids(); } //Call YTPlayer - you should include ytplayer's js and css files to your file. if ($("[data-property]").exists()){ $(".player").YTPlayer(); } //Strip timeline scripts if ($('.timeline-container').exists()){ $('.timeline-container').each(function(){ var $this = $(this); $(this).find('.dates div').each(function(){ var eventID = $(this).data('event-id'), activeDate = $($this).data('active-date'); //Add Classes to selected item $($this).find('#' + activeDate).addClass('active'); $($this).find('[data-event-id="'+ activeDate +'"]').addClass('active'); //Item on hover $(this).mouseenter(function(){ $($this).find('#' + activeDate).removeClass('active'); $($this).find('#'+ eventID).addClass('active'); $($this).find('[data-event-id="'+ activeDate +'"]').removeClass('active'); }); //Get back active class $(this).mouseleave(function() { $($this).find('#' + activeDate).addClass('active'); $($this).find('[data-event-id="'+ activeDate +'"]').addClass('active'); $($this).find('#'+ eventID).removeClass('active'); $($this).find('#' + activeDate).addClass('active'); }); }); }); } //Progress Bars if ($('.progress-bar').exists()){ $('.progress-bar').each(function(){ var $this = $(this); $($this).waypoint(function(){ var dataSource = $($this).attr('data-value'); $($this).animate({ "width" : dataSource + "%"}, 300); this.destroy(); }, {offset: '100%'}); }); } //.vertical-center $.fn.verticalPosition = function() { // Calculate Vertical Center $('.vertical-center').each(function(){ var itemH = $(this).height(); $(this).css({"margin-top": - itemH / 2}); }); }; $('body').verticalPosition(); //Call Tooltip $('[data-toggle="tooltip"], .tooltip-item').each(function(){ var self = $(this), prnt = $(self).parent(); $(self).tooltip({html: true, container: prnt }); }); //Active me - you can add this class to active with click and disable with click another area. $(".active-me-with-click").each(function(){ var item = $(this); $(window).on('click touchstart touch', function(event){ $(item).removeClass('active'); }); $(item).on('click touch', function(){ $(item).toggleClass('active'); return false; }); }); //Call popovers $('[data-toggle="popover"]').each(function(){ var self = $(this), prnt = $(self).parent(); $(self).popover({html: true, container: prnt }); }); //Call InfoCard $('[data-infocard]').each(function(){ //Variations var item = $(this), target = $(this).data('infocard'), timer; //MouseEnter $(item).on('mouseenter',function(){$(target).addClass('active');clearTimeout(timer); $(".icon-navigation").addClass("passive"); }); $(target).on('mouseenter',function(){$(target).addClass('active');clearTimeout(timer); $(".icon-navigation").addClass("passive"); }); //MouseLeave $(item).on('mouseleave',function(){ timer = setTimeout( function(){ $(target).removeClass('active'); $(".icon-navigation").removeClass("passive"); },250); }); $(target).on('mouseleave',function(){ timer = setTimeout( function(){ $(target).removeClass('active'); $(".icon-navigation").removeClass("passive"); },250); }); }); //Animated Gradient Efffects $("[data-gradient-bg]").each(function () {var grSRC = $(this).data('gradient-bg'), grSize = $(this).data('gradient-size');$(this).css({'background': 'linear-gradient(90deg,' + grSRC + ')', 'background-size': grSize + '%' + grSize + '%' }); }); //Quadra Modal if ($('#quadra_fixed_modal').exists()){ $.fn.qfmScript = function() { $('#quadra_fixed_modal:not(.hiding)').each(function(){ //Open and Close Modal var $qfm = $(this), $qfmtop = $(this).find('.quadra_fixed_modal_top'), $qfmtitle = $(this).find('#qfm_title'), $qfmbutton = $(this).find('#qfm_button'); $('.quadra_fixed_modal_top, .qfm-trigger').on('click', function(){ $qfm.toggleClass('active force-show'); $('body').toggleClass('qdr-modal-open'); $qfmtop.delay(400).toggleClass('open_modal'); $qfmtitle.delay(100).fadeToggle(900); $qfmbutton.delay(100).fadeToggle(900); $qfm.animate({ scrollTop: 0 }, "fast"); return false; }); //Close the QFM with press ESC. $(document).keyup(function(e) {if (e.keyCode == 27) { $qfm.removeClass('active force-show'); $('body').removeClass('qdr-modal-open'); $qfmtop.delay(400).removeClass('open_modal'); $qfmtitle.delay(100).fadeOut(900); $qfmbutton.delay(100).fadeIn(900); $qfm.animate({ scrollTop: 0 }, "fast"); } }); //caches a jQuery object containing the header element function showHideQFM() { if ($qfm.data('showme') && $qfm.data('hideme')) { //get positions var showMe = $qfm.data('showme'), hideMe = $qfm.data('hideme'), winHeight = $(window).outerHeight(), showMeP = $(showMe).offset().top, hideMeP = $(hideMe).offset().top, nowP = $(this).scrollTop(); //Show and hide Modal if (nowP >= showMeP - winHeight && nowP <= hideMeP - winHeight) { $qfm.addClass("clickable"); $('.drop-msg, #back-to-top').addClass('qfm-time'); } else { $qfm.removeClass("clickable"); $('.drop-msg, #back-to-top').removeClass('qfm-time'); } } } window.onscroll = showHideQFM; }); } $(window).qfmScript(); } //Hide Modal $('#qfm_button span.hide-modal').on('click touch', function(){ $('#quadra_fixed_modal').removeClass('.active .clickable').addClass('hiding'); $('body').addClass('qfm-hiding'); $('.drop-msg, #back-to-top').removeClass('qfm-time').addClass('modal-hiding'); return false; }); //Sidebar if ($(".sidebar").exists()){ $('.sidebar').sidebar('attach events', '.sidebar-button', 'show').sidebar('setting', 'transition', 'overlay'); } //Quick Contact Form Scripts $(window).on('click touchstart touch', function(event){$('.quick-contact-form').fadeOut("fast").removeClass('active'); $('body').removeClass('quick-contact-form-active');}); $('.drop-msg, .quick-contact-form-trigger').on('click touch', function(){ $('.quick-contact-form').fadeToggle("fast").toggleClass('active'); $('body').toggleClass('quick-contact-form-active'); return false;}); $('.quick-contact-form, .drop-msg, .quick-contact-form-trigger, #error_message').on('click touch touchstart', function(event){ event = event || window.event; event.stopPropagation();}); //.waypoint-active class for waypoint items if ($('.waypoint').exists()){ $('.waypoint').each(function() { var $this = $(this); $($this).waypoint(function() { $($this).addClass('waypoint-active'); }, {offset: '75%'}); }); } //Fixed Footer Options if ($('footer.footer-fixed').exists()){ var footer = $('footer.footer-fixed'), footerH = $(footer).outerHeight(); $(' ').insertAfter(footer); $('body').addClass('footer-fixed-page'); $(window).resize(function(){ var footerH = $(footer).outerHeight(); $('.footer-keeper').height(footerH); }); } //Dropdown Effect - get value to button $('button.dropdown-toggle + .dropdown-menu').each(function(){ var target = '#' + $(this).attr('aria-labelledby'), self = $(this); $(self).find('li').on('click', function(){ var cache = $(target).children(); var detail = $(this).find('div').html(); $(target).text(detail).append(cache); }); }); // Quantity up-down clicks $('.quantity').each(function(){ var minus = $(this).find('.minus'), plus = $(this).find('.plus'), numbers = $(this).find('.numbers'); $(plus).on('click', function() { $(numbers).val( parseInt($(numbers).val(), 10) + 1); }); $(minus).on('click', function() { $(numbers).val( parseInt($(numbers).val(), 10) - 1); }); }); //Text Typer if ($('#type').exists()){ $("#type").typed({ // strings: ["Typed.js is a jQuery plugin.", "It types out sentences.", "And then deletes them.", "Try it out!"], stringsElement: $('#type-get'), typeSpeed: 10, backDelay: 800, loop: true, contentType: 'html', // or text // defaults to false for infinite loop loopCount: false, showCursor: true, resetCallback: function() { newTyped(); } }); } if ($('.text-typer').exists()){ $(".text-typer").each(function(){ var self = $(this), delay= $(self).data('delay'), speed= $(self).data('speed'); $(self).typed({ // strings: ["Typed.js is a jQuery plugin.", "It types out sentences.", "And then deletes them.", "Try it out!"], stringsElement: $(self).find('.text-get'), typeSpeed: speed, backDelay: delay, loop: true, contentType: 'html', // or text // defaults to false for infinite loop loopCount: false, showCursor: true, resetCallback: function() { newTyped(); } }); }); } //Text Rotator if ($(".text-rotator").exists()) { $('.text-rotator').each(function(){ var animateType = $(this).attr('data-animation'), speed = $(this).attr('data-speed'); $(this).Morphext({ animation: animateType, separator: ",", speed: speed, }); }) } //Twitter Feed if ($(".twitter-feed").exists()) { $('.twitter-feed').each(function(){ var twitterFeeder = $(this), username = $(twitterFeeder).data('username'), count = $(twitterFeeder).data('count'), gap = $(twitterFeeder).data('gap'); $(twitterFeeder).html('Loading Tweets...'); $.getJSON( "php/twitter.php?un=" + username + "&count="+ count , function( data ) { $(twitterFeeder).empty(); var items = []; $.each( data, function( key, val ) { items.push( "
  • " + val.text + "Posted on "+ val.date +"
  • " ); }); $( "