/* Theme Name: The Project - Responsive Website Template * Author:HtmlCoder * Author URI:http://www.htmlcoder.me * Author e-mail:htmlcoder.me@gmail.com * Version:1.1.0 * Created:March 2015 * License URI:http://support.wrapbootstrap.com/ * File Description: Initializations of plugins */ (function($){ $(document).ready(function(){ if ($('.boxed .fullscreen-bg').length>0) { $("body").addClass("transparent-page-wrapper"); }; $(window).load(function() { $("body").removeClass("no-trans"); }); // Enable Smooth Scroll only on Chrome and only on Win and Linux Systems var platform = navigator.platform.toLowerCase(); if ((platform.indexOf('win') == 0 || platform.indexOf('linux') == 0) && !Modernizr.touch) { if ($.browser.webkit) { $.webkitSmoothScroll(); console.log("hello webkit"); } }; //Show dropdown on hover only for desktop devices //----------------------------------------------- var delay=0, setTimeoutConst; if ((Modernizr.mq('only all and (min-width: 768px)') && !Modernizr.touch) || $("html.ie8").length>0) { $('.main-navigation:not(.onclick) .navbar-nav>li.dropdown, .main-navigation:not(.onclick) li.dropdown>ul>li.dropdown').hover( function(){ var $this = $(this); setTimeoutConst = setTimeout(function(){ $this.addClass('open').slideDown(); $this.find('.dropdown-toggle').addClass('disabled'); }, delay); }, function(){ clearTimeout(setTimeoutConst ); $(this).removeClass('open'); $(this).find('.dropdown-toggle').removeClass('disabled'); }); }; //Show dropdown on click only for mobile devices //----------------------------------------------- if (Modernizr.mq('only all and (max-width: 767px)') || Modernizr.touch || $(".main-navigation.onclick").length>0 ) { $('.main-navigation [data-toggle=dropdown], .header-top [data-toggle=dropdown]').on('click', function(event) { // Avoid following the href location when clicking event.preventDefault(); // Avoid having the menu to close when clicking event.stopPropagation(); // close all the siblings $(this).parent().siblings().removeClass('open'); // close all the submenus of siblings $(this).parent().siblings().find('[data-toggle=dropdown]').parent().removeClass('open'); // opening the one you clicked on $(this).parent().toggleClass('open'); }); }; //Transparent Header Calculations var timer_tr; if ($(".transparent-header").length>0) { $(window).load(function() { trHeaderHeight = $("header.header").outerHeight(); $(".transparent-header .tp-bannertimer").css("marginTop", (trHeaderHeight)+"px"); }); $(window).resize(function() { if ($(this).scrollTop() < headerTopHeight + headerHeight -5) { trHeaderHeight = $("header.header").outerHeight(); $(".transparent-header .tp-bannertimer").css("marginTop", (trHeaderHeight)+"px"); } }); $(window).scroll(function() { if ($(this).scrollTop() == 0 ) { if(timer_tr) { window.clearTimeout(timer_tr); }; timer_tr = window.setTimeout(function() { trHeaderHeight = $("header.header").outerHeight(); $(".transparent-header .tp-bannertimer").css("marginTop", (trHeaderHeight)+"px"); }, 300); }; }); } if ($(".transparent-header .slideshow").length>0) { $(".header-container header.header").addClass("transparent-header-on"); } else { $(".header-container header.header").removeClass("transparent-header-on"); } //Full Width Slider with Transparent Header Calculations if ($(".transparent-header .slider-banner-fullwidth-big-height").length>0) { if (Modernizr.mq('only all and (max-width: 991px)')) { $("body").removeClass("transparent-header"); $(".header-container header.header").removeClass("transparent-header-on"); $(".tp-bannertimer").css("marginTop", "0px"); $("body").addClass("slider-banner-fullwidth-big-height-removed"); } else { $("body").addClass("transparent-header"); $(".header-container header.header").addClass("transparent-header-on"); $("body").removeClass("slider-banner-fullwidth-big-height-removed"); } }; if ($(".transparent-header .slider-banner-fullwidth-big-height").length>0 || $(".slider-banner-fullwidth-big-height-removed").length>0) { $(window).resize(function() { if (Modernizr.mq('only all and (max-width: 991px)')) { $("body").removeClass("transparent-header"); $(".header-container header.header").removeClass("transparent-header-on"); $(".tp-bannertimer").css("marginTop", "0px"); } else { $("body").addClass("transparent-header"); $(".header-container header.header").addClass("transparent-header-on"); } }); }; //Revolution Slider if ($(".slider-banner-container").length>0) { $(".tp-bannertimer").show(); $('body:not(.transparent-header) .slider-banner-container .slider-banner-fullscreen').show().revolution({ delay:8000, startwidth:1140, startheight:520, fullWidth:"off", fullScreen:"on", fullScreenOffsetContainer: ".header-container", fullScreenOffset: "0", navigationArrows:"solo", navigationStyle: "preview2", navigationHAlign:"center", navigationVAlign:"bottom", navigationHOffset:0, navigationVOffset:20, soloArrowLeftHalign:"left", soloArrowLeftValign:"center", soloArrowLeftHOffset:0, soloArrowLeftVOffset:0, soloArrowRightHalign:"right", soloArrowRightValign:"center", soloArrowRightHOffset:0, soloArrowRightVOffset:0, spinner:"spinner2", stopLoop:"off", stopAfterLoops:-1, stopAtSlide:-1, onHoverStop: "off", shuffle:"off", hideTimerBar:"off", autoHeight:"off", forceFullWidth:"off", hideThumbsOnMobile:"off", hideNavDelayOnMobile:1500, hideBulletsOnMobile:"off", hideArrowsOnMobile:"off", hideThumbsUnderResolution:0, hideSliderAtLimit:0, hideCaptionAtLimit:0, hideAllCaptionAtLilmit:0, startWithSlide:0 }); $('.transparent-header .slider-banner-container .slider-banner-fullscreen').show().revolution({ delay:8000, startwidth:1140, startheight:520, fullWidth:"off", fullScreen:"on", fullScreenOffsetContainer: ".header-top", fullScreenOffset: "", navigationArrows:"solo", navigationStyle: "preview2", navigationHAlign:"center", navigationVAlign:"bottom", navigationHOffset:0, navigationVOffset:20, soloArrowLeftHalign:"left", soloArrowLeftValign:"center", soloArrowLeftHOffset:0, soloArrowLeftVOffset:0, soloArrowRightHalign:"right", soloArrowRightValign:"center", soloArrowRightHOffset:0, soloArrowRightVOffset:0, spinner:"spinner2", stopLoop:"off", stopAfterLoops:-1, stopAtSlide:-1, onHoverStop: "off", shuffle:"off", hideTimerBar:"off", autoHeight:"off", forceFullWidth:"off", hideThumbsOnMobile:"off", hideNavDelayOnMobile:1500, hideBulletsOnMobile:"off", hideArrowsOnMobile:"off", hideThumbsUnderResolution:0, hideSliderAtLimit:0, hideCaptionAtLimit:0, hideAllCaptionAtLilmit:0, startWithSlide:0 }); $('.slider-banner-container .slider-banner-fullwidth').show().revolution({ delay:8000, startwidth:1140, startheight:450, navigationArrows:"solo", navigationStyle: "preview2", navigationHAlign:"center", navigationVAlign:"bottom", navigationHOffset:0, navigationVOffset:20, soloArrowLeftHalign:"left", soloArrowLeftValign:"center", soloArrowLeftHOffset:0, soloArrowLeftVOffset:0, soloArrowRightHalign:"right", soloArrowRightValign:"center", soloArrowRightHOffset:0, soloArrowRightVOffset:0, fullWidth:"on", spinner:"spinner2", stopLoop:"off", stopAfterLoops:-1, stopAtSlide:-1, onHoverStop: "off", shuffle:"off", autoHeight:"off", forceFullWidth:"off", hideThumbsOnMobile:"off", hideNavDelayOnMobile:1500, hideBulletsOnMobile:"off", hideArrowsOnMobile:"off", hideThumbsUnderResolution:0, hideSliderAtLimit:0, hideCaptionAtLimit:0, hideAllCaptionAtLilmit:0, startWithSlide:0 }); $('.slider-banner-container .slider-banner-fullwidth-big-height').show().revolution({ delay:8000, startwidth:1140, startheight:650, navigationArrows:"solo", navigationStyle: "preview2", navigationHAlign:"center", navigationVAlign:"bottom", navigationHOffset:0, navigationVOffset:20, soloArrowLeftHalign:"left", soloArrowLeftValign:"center", soloArrowLeftHOffset:0, soloArrowLeftVOffset:0, soloArrowRightHalign:"right", soloArrowRightValign:"center", soloArrowRightHOffset:0, soloArrowRightVOffset:0, fullWidth:"on", spinner:"spinner2", stopLoop:"off", stopAfterLoops:-1, stopAtSlide:-1, onHoverStop: "off", shuffle:"off", autoHeight:"off", forceFullWidth:"off", hideThumbsOnMobile:"off", hideNavDelayOnMobile:1500, hideBulletsOnMobile:"off", hideArrowsOnMobile:"off", hideThumbsUnderResolution:0, hideSliderAtLimit:0, hideCaptionAtLimit:0, hideAllCaptionAtLilmit:0, startWithSlide:0 }); $('.banner:not(.dark-bg) .slider-banner-container .slider-banner-boxedwidth').show().revolution({ delay:8000, startwidth:1140, startheight:450, navigationArrows:"solo", navigationStyle: "preview2", navigationHAlign:"center", navigationVAlign:"bottom", navigationHOffset:0, navigationVOffset:20, soloArrowLeftHalign:"left", soloArrowLeftValign:"center", soloArrowLeftHOffset:0, soloArrowLeftVOffset:0, soloArrowRightHalign:"right", soloArrowRightValign:"center", soloArrowRightHOffset:0, soloArrowRightVOffset:0, fullWidth:"off", spinner:"spinner2", shadow: 1, stopLoop:"off", stopAfterLoops:-1, stopAtSlide:-1, onHoverStop: "off", shuffle:"off", autoHeight:"off", forceFullWidth:"off", hideThumbsOnMobile:"off", hideNavDelayOnMobile:1500, hideBulletsOnMobile:"off", hideArrowsOnMobile:"off", hideThumbsUnderResolution:0, hideSliderAtLimit:0, hideCaptionAtLimit:0, hideAllCaptionAtLilmit:0, startWithSlide:0 }); $('.banner.dark-bg .slider-banner-container .slider-banner-boxedwidth').show().revolution({ delay:8000, startwidth:1140, startheight:450, navigationArrows:"solo", navigationStyle: "preview2", navigationHAlign:"center", navigationVAlign:"bottom", navigationHOffset:0, navigationVOffset:20, soloArrowLeftHalign:"left", soloArrowLeftValign:"center", soloArrowLeftHOffset:0, soloArrowLeftVOffset:0, soloArrowRightHalign:"right", soloArrowRightValign:"center", soloArrowRightHOffset:0, soloArrowRightVOffset:0, fullWidth:"off", spinner:"spinner2", shadow: 3, stopLoop:"off", stopAfterLoops:-1, stopAtSlide:-1, onHoverStop: "off", shuffle:"off", autoHeight:"off", forceFullWidth:"off", hideThumbsOnMobile:"off", hideNavDelayOnMobile:1500, hideBulletsOnMobile:"off", hideArrowsOnMobile:"off", hideThumbsUnderResolution:0, hideSliderAtLimit:0, hideCaptionAtLimit:0, hideAllCaptionAtLilmit:0, startWithSlide:0 }); $('.slider-banner-container .slider-banner-boxedwidth-no-shadow').show().revolution({ delay:8000, startwidth:1140, startheight:450, navigationArrows:"solo", navigationStyle: "preview2", navigationHAlign:"center", navigationVAlign:"bottom", navigationHOffset:0, navigationVOffset:20, soloArrowLeftHalign:"left", soloArrowLeftValign:"center", soloArrowLeftHOffset:0, soloArrowLeftVOffset:0, soloArrowRightHalign:"right", soloArrowRightValign:"center", soloArrowRightHOffset:0, soloArrowRightVOffset:0, fullWidth:"off", spinner:"spinner2", shadow: 0, stopLoop:"off", stopAfterLoops:-1, stopAtSlide:-1, onHoverStop: "off", shuffle:"off", autoHeight:"off", forceFullWidth:"off", hideThumbsOnMobile:"off", hideNavDelayOnMobile:1500, hideBulletsOnMobile:"off", hideArrowsOnMobile:"off", hideThumbsUnderResolution:0, hideSliderAtLimit:0, hideCaptionAtLimit:0, hideAllCaptionAtLilmit:0, startWithSlide:0 }); $('.banner:not(.dark-bg) .slider-banner-container .slider-banner-boxedwidth-stopped').show().revolution({ delay:8000, startwidth:1140, startheight:450, navigationArrows:"solo", navigationStyle: "preview2", navigationHAlign:"center", navigationVAlign:"bottom", navigationHOffset:0, navigationVOffset:20, soloArrowLeftHalign:"left", soloArrowLeftValign:"center", soloArrowLeftHOffset:0, soloArrowLeftVOffset:0, soloArrowRightHalign:"right", soloArrowRightValign:"center", soloArrowRightHOffset:0, soloArrowRightVOffset:0, fullWidth:"off", spinner:"spinner2", shadow: 1, stopLoop:"off", stopAfterLoops:0, stopAtSlide:1, onHoverStop: "off", shuffle:"off", autoHeight:"off", forceFullWidth:"off", hideThumbsOnMobile:"off", hideNavDelayOnMobile:1500, hideBulletsOnMobile:"off", hideArrowsOnMobile:"off", hideThumbsUnderResolution:0, hideSliderAtLimit:0, hideCaptionAtLimit:0, hideAllCaptionAtLilmit:0, startWithSlide:0 }); $('.banner.dark-bg .slider-banner-container .slider-banner-boxedwidth-stopped').show().revolution({ delay:8000, startwidth:1140, startheight:450, navigationArrows:"solo", navigationStyle: "preview2", navigationHAlign:"center", navigationVAlign:"bottom", navigationHOffset:0, navigationVOffset:20, soloArrowLeftHalign:"left", soloArrowLeftValign:"center", soloArrowLeftHOffset:0, soloArrowLeftVOffset:0, soloArrowRightHalign:"right", soloArrowRightValign:"center", soloArrowRightHOffset:0, soloArrowRightVOffset:0, fullWidth:"off", spinner:"spinner2", shadow: 3, stopLoop:"off", stopAfterLoops:0, stopAtSlide:1, onHoverStop: "off", shuffle:"off", autoHeight:"off", forceFullWidth:"off", hideThumbsOnMobile:"off", hideNavDelayOnMobile:1500, hideBulletsOnMobile:"off", hideArrowsOnMobile:"off", hideThumbsUnderResolution:0, hideSliderAtLimit:0, hideCaptionAtLimit:0, hideAllCaptionAtLilmit:0, startWithSlide:0 }); }; //Owl carousel //----------------------------------------------- if ($('.owl-carousel').length>0) { $(".owl-carousel.carousel").owlCarousel({ items: 4, pagination: false, navigation: true, navigationText: false }); $(".owl-carousel.carousel-autoplay").owlCarousel({ items: 4, autoPlay: 5000, pagination: false, navigation: true, navigationText: false }); $(".owl-carousel.clients").owlCarousel({ items: 6, autoPlay: true, pagination: false, itemsDesktopSmall: [992,4], itemsTablet: [768,4], itemsMobile: [479,3] }); $(".owl-carousel.content-slider").owlCarousel({ singleItem: true, autoPlay: 5000, navigation: false, navigationText: false, pagination: false }); $(".owl-carousel.content-slider-with-controls").owlCarousel({ singleItem: true, autoPlay: false, navigation: true, pagination: true }); $(".owl-carousel.content-slider-with-large-controls").owlCarousel({ singleItem: true, autoPlay: false, navigation: true, pagination: true }); $(".owl-carousel.content-slider-with-controls-autoplay").owlCarousel({ singleItem: true, autoPlay: 5000, navigation: true, pagination: true }); $(".owl-carousel.content-slider-with-large-controls-autoplay").owlCarousel({ singleItem: true, autoPlay: 5000, navigation: true, pagination: true }); $(".owl-carousel.content-slider-with-controls-autoplay-hover-stop").owlCarousel({ singleItem: true, autoPlay: 5000, navigation: true, pagination: true, stopOnHover: true }); }; // Fixed header //----------------------------------------------- headerTopHeight = $(".header-top").outerHeight(), headerHeight = $("header.header.fixed").outerHeight(); $(window).resize(function() { if(($(this).scrollTop() < headerTopHeight + headerHeight -5 ) && ($(window).width() > 767)) { headerTopHeight = $(".header-top").outerHeight(), headerHeight = $("header.header.fixed").outerHeight(); } }); $(window).scroll(function() { if (($(".header.fixed").length > 0) && !($(".transparent-header .slideshow").length>0)) { if (($(this).scrollTop() > headerTopHeight + headerHeight) && ($(window).width() > 767)) { $("body").addClass("fixed-header-on"); $(".header.fixed").addClass('animated object-visible fadeInDown'); $(".header-container").css("paddingBottom", (headerHeight)+"px"); } else { $("body").removeClass("fixed-header-on"); $(".header-container").css("paddingBottom", (0)+"px"); $(".header.fixed").removeClass('animated object-visible fadeInDown'); } } else if ($(".header.fixed").length > 0) { if (($(this).scrollTop() > headerTopHeight + headerHeight) && ($(window).width() > 767)) { $("body").addClass("fixed-header-on"); $(".header.fixed").addClass('animated object-visible fadeInDown'); } else { $("body").removeClass("fixed-header-on"); $(".header.fixed").removeClass('animated object-visible fadeInDown'); } }; }); // Charts //----------------------------------------------- if ($(".graph").length>0) { // Creates random numbers you don't need this for real graphs var randomScalingFactor = function(){ return Math.round(Math.random()*500)}; if ($(".graph.line").length>0) { // Data for line charts var lineChartData = { labels : ["January","February","March","April","May","June","July"], datasets : [ { label: "First dataset", fillColor : "rgba(188,188,188,0.2)", strokeColor : "rgba(188,188,188,1)", pointColor : "rgba(188,188,188,1)", pointStrokeColor : "#fff", pointHighlightFill : "#fff", pointHighlightStroke : "rgba(188,188,188,1)", data : [250,300,250,200,250,300,250] }, { label: "Second dataset", fillColor : "rgba(126,187,205,0.2)", strokeColor : "rgba(126,187,205,1)", pointColor : "rgba(126,187,205,1)", pointStrokeColor : "#fff", pointHighlightFill : "#fff", pointHighlightStroke : "rgba(126,187,205,1)", data : [300,250,200,250,300,250,200] }, { label: "Third dataset", fillColor : "rgba(98,187,205,0.2)", strokeColor : "rgba(98,187,205,1)", pointColor : "rgba(98,187,205,1)", pointStrokeColor : "#fff", pointHighlightFill : "#fff", pointHighlightStroke : "rgba(98,187,205,1)", data : [0,100,200,300,400,500,400] } ] } // Line Charts Initialization $(window).load(function() { var ctx = document.getElementById("lines-graph").getContext("2d"); window.newLine = new Chart(ctx).Line(lineChartData, { responsive: true, bezierCurve : false }); }); } if ($(".graph.bar").length>0) { // Data for bar charts var barChartData = { labels : ["January","February","March","April","May","June","July"], datasets : [ { fillColor : "rgba(188,188,188,0.5)", strokeColor : "rgba(188,188,188,0.8)", highlightFill: "rgba(188,188,188,0.75)", highlightStroke: "rgba(188,188,188,1)", data : [randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor()] }, { fillColor : "rgba(168,187,205,0.5)", strokeColor : "rgba(168,187,205,0.8)", highlightFill : "rgba(168,187,205,0.75)", highlightStroke : "rgba(168,187,205,1)", data : [randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor()] } ] } // Bar Charts Initialization $(window).load(function() { var ctx = document.getElementById("bars-graph").getContext("2d"); window.myBar = new Chart(ctx).Bar(barChartData, { responsive : true }); }); } if ($(".graph.pie").length>0) { // Data for pie chart var pieData = [ { value: 120, color:"#09afdf", highlight: "#6BD5F4", label: "Blue" }, { value: 120, color: "#FDB45C", highlight: "#FFC870", label: "Yellow" }, { value: 120, color: "#4D5360", highlight: "#616774", label: "Dark Grey" } ]; // Pie Chart Initialization $(window).load(function() { var ctx = document.getElementById("pie-graph").getContext("2d"); window.myPie = new Chart(ctx).Pie(pieData); }); } if ($(".graph.doughnut").length>0) { // Data for doughnut chart var doughnutData = [ { value: 120, color:"#09afdf", highlight: "#6BD5F4", label: "Blue" }, { value: 120, color: "#FDB45C", highlight: "#FFC870", label: "Yellow" }, { value: 120, color: "#4D5360", highlight: "#616774", label: "Dark Grey" } ]; // Doughnut Chart Initialization $(window).load(function() { var ctx = document.getElementById("doughnut-graph").getContext("2d"); window.myDoughnut = new Chart(ctx).Doughnut(doughnutData, {responsive : true}); }); } }; // Magnific popup //----------------------------------------------- if (($(".popup-img").length > 0) || ($(".popup-iframe").length > 0) || ($(".popup-img-single").length > 0)) { $(".popup-img").magnificPopup({ type:"image", gallery: { enabled: true, } }); $(".popup-img-single").magnificPopup({ type:"image", gallery: { enabled: false, } }); $('.popup-iframe').magnificPopup({ disableOn: 700, type: 'iframe', preloader: false, fixedContentPos: false }); }; // Animations //----------------------------------------------- if ($("[data-animation-effect]").length>0) { $("[data-animation-effect]").each(function() { if(Modernizr.csstransitions) { var waypoints = $(this).waypoint(function(direction) { var appearDelay = $(this.element).attr("data-effect-delay"), animatedObject = $(this.element); setTimeout(function() { animatedObject.addClass('animated object-visible ' + animatedObject.attr("data-animation-effect")); }, appearDelay); this.destroy(); },{ offset: '90%' }); } else { $(this).addClass('object-visible'); } }); }; // Text Rotators //----------------------------------------------- if ($(".text-rotator").length>0) { $(".text-rotator").each(function() { var tr_animationEffect = $(this).attr("data-rotator-animation-effect"); $(this).Morphext({ animation: ""+tr_animationEffect+"", // Overrides default "bounceIn" separator: ",", // Overrides default "," speed: 3000 // Overrides default 2000 }); }); }; // Stats Count To //----------------------------------------------- if ($(".stats [data-to]").length>0) { $(".stats [data-to]").each(function() { var stat_item = $(this), offset = stat_item.offset().top; if($(window).scrollTop() > (offset - 800) && !(stat_item.hasClass('counting'))) { stat_item.addClass('counting'); stat_item.countTo(); }; $(window).scroll(function() { if($(window).scrollTop() > (offset - 800) && !(stat_item.hasClass('counting'))) { stat_item.addClass('counting'); stat_item.countTo(); } }); }); }; // Isotope filters //----------------------------------------------- if ($('.isotope-container').length>0 || $('.masonry-grid').length>0 || $('.masonry-grid-fitrows').length>0 || $('.isotope-container-fitrows').length>0) { $(window).load(function() { $('.masonry-grid').isotope({ itemSelector: '.masonry-grid-item', layoutMode: 'masonry' }); $('.masonry-grid-fitrows').isotope({ itemSelector: '.masonry-grid-item', layoutMode: 'fitRows' }); $('.isotope-container').fadeIn(); var $container = $('.isotope-container').isotope({ itemSelector: '.isotope-item', layoutMode: 'masonry', transitionDuration: '0.6s', filter: "*" }); $('.isotope-container-fitrows').fadeIn(); var $container_fitrows = $('.isotope-container-fitrows').isotope({ itemSelector: '.isotope-item', layoutMode: 'fitRows', transitionDuration: '0.6s', filter: "*" }); // filter items on button click $('.filters').on( 'click', 'ul.nav li a', function() { var filterValue = $(this).attr('data-filter'); $(".filters").find("li.active").removeClass("active"); $(this).parent().addClass("active"); $container.isotope({ filter: filterValue }); $container_fitrows.isotope({ filter: filterValue }); return false; }); }); $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { $('.tab-pane .masonry-grid-fitrows').isotope({ itemSelector: '.masonry-grid-item', layoutMode: 'fitRows' }); }); }; // Animated Progress Bars //----------------------------------------------- if ($("[data-animate-width]").length>0) { $("[data-animate-width]").each(function() { if (Modernizr.touch || !Modernizr.csstransitions) { $(this).find("span").hide(); }; var waypoints = $(this).waypoint(function(direction) { $(this.element).animate({width: $(this.element).attr("data-animate-width")}, 800 ); this.destroy(); if (Modernizr.touch || !Modernizr.csstransitions) { $(this.element).find("span").show('slow'); }; },{ offset: '90%' }); }); }; // Animated Circular Progress Bars //----------------------------------------------- if ($(".knob").length>0) { $(".knob").knob(); $(".knob").each(function() { var animateVal = $(this).attr("data-animate-value"); $(this).animate({animatedVal: animateVal}, { duration: 2000, step: function() { $(this).val(Math.ceil(this.animatedVal)).trigger("change"); } }); }); } //Video Background //----------------------------------------------- if($(".video-background").length>0) { if (Modernizr.touch) { $(".video-background").vide({ mp4: "videos/background-video.mp4", webm: "videos/background-video.webm", poster: "videos/video-fallback.jpg" }, { volume: 1, playbackRate: 1, muted: true, loop: true, autoplay: true, position: "50% 100%", // Similar to the CSS `background-position` property. posterType: "jpg", // Poster image type. "detect" — auto-detection; "none" — no poster; "jpg", "png", "gif",... - extensions. resizing: true }); } else { $(".video-background").vide({ mp4: "videos/background-video.mp4", webm: "videos/background-video.webm", poster: "videos/video-poster.jpg" }, { volume: 1, playbackRate: 1, muted: true, loop: true, autoplay: true, position: "50% 100%", // Similar to the CSS `background-position` property. posterType: "jpg", // Poster image type. "detect" — auto-detection; "none" — no poster; "jpg", "png", "gif",... - extensions. resizing: true }); }; }; if($(".video-background-banner").length>0) { if (Modernizr.touch) { $(".video-background-banner").vide({ mp4: "videos/background-video-banner.mp4", webm: "videos/background-video-banner.webm", poster: "videos/video-fallback.jpg" }, { volume: 1, playbackRate: 1, muted: true, loop: true, autoplay: true, position: "50% 50%", // Similar to the CSS `background-position` property. posterType: "jpg", // Poster image type. "detect" — auto-detection; "none" — no poster; "jpg", "png", "gif",... - extensions. resizing: true }); } else { $(".video-background-banner").vide({ mp4: "videos/background-video-banner.mp4", webm: "videos/background-video-banner.webm", poster: "videos/video-banner-poster.jpg" }, { volume: 1, playbackRate: 1, muted: true, loop: true, autoplay: true, position: "50% 50%", // Similar to the CSS `background-position` property. posterType: "jpg", // Poster image type. "detect" — auto-detection; "none" — no poster; "jpg", "png", "gif",... - extensions. resizing: true }); }; }; //Scroll totop //----------------------------------------------- $(window).scroll(function() { if($(this).scrollTop() != 0) { $(".scrollToTop").fadeIn(); } else { $(".scrollToTop").fadeOut(); } }); $(".scrollToTop").click(function() { $("body,html").animate({scrollTop:0},800); }); //Modal //----------------------------------------------- if($(".modal").length>0) { $(".modal").each(function() { $(".modal").prependTo( "body" ); }); } // Pricing tables popovers //----------------------------------------------- if ($(".pricing-tables").length>0) { $(".plan .pt-popover").popover({ trigger: 'hover', container: 'body' }); }; // Contact forms validation //----------------------------------------------- if($("#contact-form").length>0) { $("#contact-form").validate({ submitHandler: function(form) { $('.submit-button').button("loading"); $.ajax({ type: "POST", url: "php/email-sender.php", data: { "name": $("#contact-form #name").val(), "email": $("#contact-form #email").val(), "subject": $("#contact-form #subject").val(), "message": $("#contact-form #message").val() }, dataType: "json", success: function (data) { if (data.sent == "yes") { $("#MessageSent").removeClass("hidden"); $("#MessageNotSent").addClass("hidden"); $(".submit-button").removeClass("btn-default").addClass("btn-success").prop('value', 'Message Sent'); $("#contact-form .form-control").each(function() { $(this).prop('value', '').parent().removeClass("has-success").removeClass("has-error"); }); } else { $("#MessageNotSent").removeClass("hidden"); $("#MessageSent").addClass("hidden"); } } }); }, // debug: true, errorPlacement: function(error, element) { error.insertBefore( element ); }, onkeyup: false, onclick: false, rules: { name: { required: true, minlength: 2 }, email: { required: true, email: true }, subject: { required: true }, message: { required: true, minlength: 10 } }, messages: { name: { required: "Please specify your name", minlength: "Your name must be longer than 2 characters" }, email: { required: "We need your email address to contact you", email: "Please enter a valid email address e.g. name@domain.com" }, subject: { required: "Please enter a subject" }, message: { required: "Please enter a message", minlength: "Your message must be longer than 10 characters" } }, errorElement: "span", highlight: function (element) { $(element).parent().removeClass("has-success").addClass("has-error"); $(element).siblings("label").addClass("hide"); }, success: function (element) { $(element).parent().removeClass("has-error").addClass("has-success"); $(element).siblings("label").removeClass("hide"); } }); }; if($("#footer-form").length>0) { $("#footer-form").validate({ submitHandler: function(form) { $('.submit-button').button("loading"); $.ajax({ type: "POST", url: "php/email-sender.php", data: { "name": $("#footer-form #name2").val(), "email": $("#footer-form #email2").val(), "subject": "Message from contact form", "message": $("#footer-form #message2").val() }, dataType: "json", success: function (data) { if (data.sent == "yes") { $("#MessageSent2").removeClass("hidden"); $("#MessageNotSent2").addClass("hidden"); $(".submit-button").removeClass("btn-default").addClass("btn-success").prop('value', 'Message Sent'); $("#footer-form .form-control").each(function() { $(this).prop('value', '').parent().removeClass("has-success").removeClass("has-error"); }); } else { $("#MessageNotSent2").removeClass("hidden"); $("#MessageSent2").addClass("hidden"); } } }); }, // debug: true, errorPlacement: function(error, element) { error.insertAfter( element ); }, onkeyup: false, onclick: false, rules: { name2: { required: true, minlength: 2 }, email2: { required: true, email: true }, message2: { required: true, minlength: 10 } }, messages: { name2: { required: "Please specify your name", minlength: "Your name must be longer than 2 characters" }, email2: { required: "We need your email address to contact you", email: "Please enter a valid email address e.g. name@domain.com" }, message2: { required: "Please enter a message", minlength: "Your message must be longer than 10 characters" } }, errorElement: "span", highlight: function (element) { $(element).parent().removeClass("has-success").addClass("has-error"); $(element).siblings("label").addClass("hide"); }, success: function (element) { $(element).parent().removeClass("has-error").addClass("has-success"); $(element).siblings("label").removeClass("hide"); } }); }; if($("#sidebar-form").length>0) { $("#sidebar-form").validate({ submitHandler: function(form) { $('.submit-button').button("loading"); $.ajax({ type: "POST", url: "php/email-sender.php", data: { "name": $("#sidebar-form #name3").val(), "email": $("#sidebar-form #email3").val(), "subject": "Message from FAQ page", "category": $("#sidebar-form #category").val(), "message": $("#sidebar-form #message3").val() }, dataType: "json", success: function (data) { if (data.sent == "yes") { $("#MessageSent3").removeClass("hidden"); $("#MessageNotSent3").addClass("hidden"); $(".submit-button").removeClass("btn-default").addClass("btn-success").prop('value', 'Message Sent'); $("#sidebar-form .form-control").each(function() { $(this).prop('value', '').parent().removeClass("has-success").removeClass("has-error"); }); } else { $("#MessageNotSent3").removeClass("hidden"); $("#MessageSent3").addClass("hidden"); } } }); }, // debug: true, errorPlacement: function(error, element) { error.insertAfter( element ); }, onkeyup: false, onclick: false, rules: { name3: { required: true, minlength: 2 }, email3: { required: true, email: true }, message3: { required: true, minlength: 10 } }, messages: { name3: { required: "Please specify your name", minlength: "Your name must be longer than 2 characters" }, email3: { required: "We need your email address to contact you", email: "Please enter a valid email address e.g. name@domain.com" }, message3: { required: "Please enter a message", minlength: "Your message must be longer than 10 characters" } }, errorElement: "span", highlight: function (element) { $(element).parent().removeClass("has-success").addClass("has-error"); }, success: function (element) { $(element).parent().removeClass("has-error").addClass("has-success"); } }); }; if($("#rsvp").length>0) { $("#rsvp").validate({ submitHandler: function(form) { $('.submit-button').button("loading"); $.ajax({ type: "POST", url: "php/email-sender.php", data: { "name": $("#rsvp #name").val(), "email": $("#rsvp #email").val(), "guests": $("#rsvp #guests").val(), "subject": "RSVP", "events": $("#rsvp #events").val() }, dataType: "json", success: function (data) { if (data.sent == "yes") { $("#MessageSent").removeClass("hidden"); $("#MessageNotSent").addClass("hidden"); $(".submit-button").removeClass("btn-default").addClass("btn-success").prop('value', 'Message Sent'); $("#rsvp .form-control").each(function() { $(this).prop('value', '').parent().removeClass("has-success").removeClass("has-error"); }); } else { $("#MessageNotSent").removeClass("hidden"); $("#MessageSent").addClass("hidden"); } } }); }, // debug: true, errorPlacement: function(error, element) { error.insertAfter( element ); }, onkeyup: false, onclick: false, rules: { name: { required: true, minlength: 2 }, email: { required: true, email: true }, guests: { required: true }, events: { required: true } }, messages: { name: { required: "Please specify your name", minlength: "Your name must be longer than 2 characters" }, email: { required: "We need your email address to contact you", email: "Please enter a valid email address e.g. name@domain.com" } }, errorElement: "span", highlight: function (element) { $(element).parent().removeClass("has-success").addClass("has-error"); $(element).siblings("label").addClass("hide"); }, success: function (element) { $(element).parent().removeClass("has-error").addClass("has-success"); $(element).siblings("label").removeClass("hide"); } }); }; // Affix Menu //----------------------------------------------- if ($(".affix-menu").length>0) { setTimeout(function () { var $sideBar = $('.sidebar') $sideBar.affix({ offset: { top: function () { var offsetTop = $sideBar.offset().top return (this.top = offsetTop - 65) }, bottom: function () { var affixBottom = $(".footer").outerHeight(true) + $(".subfooter").outerHeight(true) if ($(".footer-top").length>0) { affixBottom = affixBottom + $(".footer-top").outerHeight(true) } return (this.bottom = affixBottom+50) } } }) }, 100) } //Scroll Spy //----------------------------------------------- if($(".scrollspy").length>0) { $("body").addClass("scroll-spy"); if($(".fixed.header").length>0) { $('body').scrollspy({ target: '.scrollspy', offset: 85 }); } else { $('body').scrollspy({ target: '.scrollspy', offset: 20 }); } } //Smooth Scroll //----------------------------------------------- if ($(".smooth-scroll").length>0) { if(($(".header.fixed").length>0) && (Modernizr.mq('only all and (min-width: 768px)'))) { $('.smooth-scroll a[href*=#]:not([href=#]), a[href*=#]:not([href=#]).smooth-scroll').click(function() { if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); if (target.length) { $('html,body').animate({ scrollTop: target.offset().top-64 }, 1000); return false; } } }); } else { $('.smooth-scroll a[href*=#]:not([href=#]), a[href*=#]:not([href=#]).smooth-scroll').click(function() { if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); if (target.length) { $('html,body').animate({ scrollTop: target.offset().top }, 1000); return false; } } }); } } // Offcanvas side navbar //----------------------------------------------- if ($("#offcanvas").length>0) { $('#offcanvas').offcanvas({ canvas: "body", disableScrolling: false, toggle: false }); }; if ($("#offcanvas").length>0) { $('#offcanvas [data-toggle=dropdown]').on('click', function(event) { // Avoid following the href location when clicking event.preventDefault(); // Avoid having the menu to close when clicking event.stopPropagation(); // close all the siblings $(this).parent().siblings().removeClass('open'); // close all the submenus of siblings $(this).parent().siblings().find('[data-toggle=dropdown]').parent().removeClass('open'); // opening the one you clicked on $(this).parent().toggleClass('open'); }); }; // Parallax section //----------------------------------------------- if (($(".parallax").length>0) && !Modernizr.touch ){ $(".parallax").parallax("50%", 0.2); }; if (($(".parallax-2").length>0) && !Modernizr.touch ){ $(".parallax-2").parallax("50%", 0.3); }; if (($(".parallax-3").length>0) && !Modernizr.touch ){ $(".parallax-3").parallax("50%", 0.4); }; // Notify Plugin //----------------------------------------------- if (($(".main-navigation.onclick").length>0) && !Modernizr.touch ){ $.notify({ // options message: 'The Dropdowns of the Main Menu, are now open with click on Parent Items. Click "Home" to checkout this behavior.' },{ // settings type: 'info', delay: 10000, offset : { y: 150, x: 20 } }); }; if (!($(".main-navigation.animated").length>0) && !Modernizr.touch && $(".main-navigation").length>0){ $.notify({ // options message: 'The animations of main menu are disabled.' },{ // settings type: 'info', delay: 10000, offset : { y: 150, x: 20 } }); }; if ($(".btn-alert").length>0){ $(".btn-alert").on('click', function(event) { $.notify({ // options message: 'Great! you have just created this message :-) you can configure this into the template.js file' },{ // settings type: 'info', delay: 4000, offset : { y: 100, x: 20 } }); return false; }); }; // Remove Button //----------------------------------------------- $(".btn-remove").click(function() { $(this).closest(".remove-data").remove(); }); // Shipping Checkbox //----------------------------------------------- if ($("#shipping-info-check").is(':checked')) { $("#shipping-information").hide(); } $("#shipping-info-check").change(function(){ if ($(this).is(':checked')) { $("#shipping-information").slideToggle(); } else { $("#shipping-information").slideToggle(); } }); // Full Width Image Overlay //----------------------------------------------- if ($(".full-image-overlay").length>0) { overlayHeight = $(".full-image-overlay").outerHeight(); $(".full-image-overlay").css("marginTop",-overlayHeight/2); }; //This will prevent the event from bubbling up and close the dropdown when you type/click on text boxes (Header Top). //----------------------------------------------- $('.header-top .dropdown-menu input').click(function(e) { e.stopPropagation(); }); }); // End document ready })(this.jQuery); if (jQuery(".btn-print").length>0) { function print_window() { var mywindow = window; mywindow.document.close(); mywindow.focus(); mywindow.print(); mywindow.close(); } }