(function($,window,document,Math,undefined) { var div = $( "
" )[0], rsrc = /url\(["']?(.*?)["']?\)/, watched = [], positions = { top: 0, left: 0, bottom: 1, right: 1, center: .5 }; // feature detection if ( "backgroundSize" in div.style && !$.debugBGS ) { return; } $.cssHooks.backgroundSize = { set: function( elem, value ) { var firstTime = !$.data( elem, "bgsImg" ), pos, $wrapper, $img; $.data( elem, "bgsValue", value ); if ( firstTime ) { // add this element to the 'watched' list so that it's updated on resize watched.push( elem ); $.refreshBackgroundDimensions( elem, true ); // create wrapper and img $wrapper = $( "
" ).css({ position: "absolute", zIndex: -1, top: 0, right: 0, left: 0, bottom: 0, overflow: "hidden" }); $img = $( "" ).css({ position: "absolute" }).appendTo( $wrapper ), $wrapper.prependTo( elem ); $.data( elem, "bgsImg", $img[0] ); pos = ( // Firefox, Chrome (for debug) $.css( elem, "backgroundPosition" ) || // IE8 $.css( elem, "backgroundPositionX" ) + " " + $.css( elem, "backgroundPositionY" ) ).split(" "); // Only compatible with 1 or 2 percentage or keyword values, // Not yet compatible with length values and 4 values. $.data( elem, "bgsPos", [ positions[ pos[0] ] || parseFloat( pos[0] ) / 100, positions[ pos[1] ] || parseFloat( pos[1] ) / 100 ]); // This is the part where we mess with the existing DOM // to make sure that the background image is correctly zIndexed $.css( elem, "zIndex" ) == "auto" && ( elem.style.zIndex = 0 ); $.css( elem, "position" ) == "static" && ( elem.style.position = "relative" ); $.refreshBackgroundImage( elem ); } else { $.refreshBackground( elem ); } }, get: function( elem ) { return $.data( elem, "bgsValue" ) || ""; } }; // The background should refresh automatically when changing the background-image $.cssHooks.backgroundImage = { set: function( elem, value ) { // if the element has a backgroundSize, refresh its background return $.data( elem, "bgsImg") ? $.refreshBackgroundImage( elem, value ) : // otherwise set the background-image normally value; } }; $.refreshBackgroundDimensions = function( elem, noBgRefresh ) { var $elem = $(elem), currDim = { width: $elem.innerWidth(), height: $elem.innerHeight() }, prevDim = $.data( elem, "bgsDim" ), changed = !prevDim || currDim.width != prevDim.width || currDim.height != prevDim.height; $.data( elem, "bgsDim", currDim ); if ( changed && !noBgRefresh ) { $.refreshBackground( elem ); } }; $.refreshBackgroundImage = function( elem, value ) { var img = $.data( elem, "bgsImg" ), currSrc = ( rsrc.exec( value || $.css( elem, "backgroundImage" ) ) || [] )[1], prevSrc = img && img.src, changed = currSrc != prevSrc, imgWidth, imgHeight; if ( changed ) { img.style.height = img.style.width = "auto"; img.onload = function() { var dim = { width: img.width, height: img.height }; // ignore onload on the proxy image if ( dim.width == 1 && dim.height == 1 ) { return; } $.data( elem, "bgsImgDim", dim ); $.data( elem, "bgsConstrain", false ); $.refreshBackground( elem ); img.style.visibility = "visible"; img.onload = null; }; img.style.visibility = "hidden"; img.src = currSrc; if ( img.readyState || img.complete ) { img.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=="; img.src = currSrc; } elem.style.backgroundImage = "none"; } }; $.refreshBackground = function( elem ) { var value = $.data( elem, "bgsValue" ), elemDim = $.data( elem, "bgsDim" ), imgDim = $.data( elem, "bgsImgDim" ), $img = $( $.data( elem, "bgsImg" ) ), pos = $.data( elem, "bgsPos" ), prevConstrain = $.data( elem, "bgsConstrain" ), currConstrain, elemRatio = elemDim.width / elemDim.height, imgRatio = imgDim.width / imgDim.height, delta; if ( value == "contain" ) { if ( imgRatio > elemRatio ) { $.data( elem, "bgsConstrain", ( currConstrain = "width" ) ); delta = Math.floor( ( elemDim.height - elemDim.width / imgRatio ) * pos[1] ); $img.css({ top: delta }); // when switchin from height to with constraint, // make sure to release contraint on height and reset left if ( currConstrain != prevConstrain ) { $img.css({ width: "100%", height: "auto", left: 0 }); } } else { $.data( elem, "bgsConstrain", ( currConstrain = "height" ) ); delta = Math.floor( ( elemDim.width - elemDim.height * imgRatio ) * pos[0] ); $img.css({ left: delta }); if ( currConstrain != prevConstrain ) { $img.css({ height: "100%", width: "auto", top: 0 }); } } } else if ( value == "cover" ) { if ( imgRatio > elemRatio ) { $.data( elem, "bgsConstrain", ( currConstrain = "height" ) ); delta = Math.floor( ( elemDim.height * imgRatio - elemDim.width ) * pos[0] ); $img.css({ left: -delta }); if ( currConstrain != prevConstrain ) { $img.css({ height:"100%", width: "auto", top: 0 }); } } else { $.data( elem, "bgsConstrain", ( currConstrain = "width" ) ); delta = Math.floor( ( elemDim.width / imgRatio - elemDim.height ) * pos[1] ); $img.css({ top: -delta }); if ( currConstrain != prevConstrain ) { $img.css({ width: "100%", height: "auto", left: 0 }); } } } } // Built-in throttledresize var $event = $.event, $special, dummy = {_:0}, frame = 0, wasResized, animRunning; $special = $event.special.throttledresize = { setup: function() { $( this ).on( "resize", $special.handler ); }, teardown: function() { $( this ).off( "resize", $special.handler ); }, handler: function( event, execAsap ) { // Save the context var context = this, args = arguments; wasResized = true; if ( !animRunning ) { $(dummy).animate(dummy, { duration: Infinity, step: function() { frame++; if ( frame > $special.threshold && wasResized || execAsap ) { // set correct event type event.type = "throttledresize"; $event.dispatch.apply( context, args ); wasResized = false; frame = 0; } if ( frame > 9 ) { $(dummy).stop(); animRunning = false; frame = 0; } }}); animRunning = true; } }, threshold: 1 }; // All backgrounds should refresh automatically when the window is resized $(window).on("throttledresize", function() { $(watched).each(function() { $.refreshBackgroundDimensions( this ); }); }); })(jQuery,window,document,Math); jQuery(function($){ /*========================================*/ /* nav-wrapper /*========================================*/ $(".dropdown").hover( function() {$(this).children(".dropdown-menu").show()}, function() {$(this).children(".dropdown-menu").hide()} ); var resize_width = $(window).width(); var resize_height = $(window).height(); $(window).on('resize', function() { if ($(window).width() != resize_width || $(window).height() != resize_height) { if ($(window).height() < $('.nav-container').outerHeight()) { $('body').css('position', 'relative'); $('.nav-wrapper').css({ 'position': 'absolute', }); } else { $('body').css('position', ''); $('.nav-wrapper').css({ 'position': 'fixed', }); } resize_width = $(window).width(); resize_height = $(window).height(); } }); if ($(window).height() < $('.nav-container').outerHeight()) { $('body').css('position', 'relative'); $('.nav-wrapper').css({ 'position': 'absolute', }); } else { $('body').css('position', ''); $('.nav-wrapper').css({ 'position': 'fixed', }); } $(".carousel.slide").css({ backgroundSize: "cover" }); /*========================================*/ /* toggle-butn & mobile-nav /*========================================*/ var menuRight = document.getElementById( 'mobile-nav' ), body = document.body; showRight.onclick = function() { classie.toggle( this, 'active' ); classie.toggle( menuRight, 'menu-open' ); disableOther( 'showRight' ); $(".toggle-bar").toggleClass("active"); }; function disableOther( button ) { if( button !== 'showRight' ) { classie.toggle( showRight, 'disabled' ); } }; $(function () { $('#mobile-menu').metisMenu(); }); /*========================================*/ /* main-banner /*========================================*/ var dragging = true; var owlElementID = "#main-banner"; function fadeInReset() { if (!dragging) { $(owlElementID + " .caption .fadeIn-1, " + owlElementID + " .caption .fadeIn-2, " + owlElementID + " .caption .fadeIn-3").stop().delay(800).animate({ opacity: 0 }, { duration: 400, easing: "easeInCubic" }); } else { $(owlElementID + " .caption .fadeIn-1, " + owlElementID + " .caption .fadeIn-2, " + owlElementID + " .caption .fadeIn-3").css({ opacity: 0 }); } } function fadeInDownReset() { if (!dragging) { $(owlElementID + " .caption .fadeInDown-1, " + owlElementID + " .caption .fadeInDown-2, " + owlElementID + " .caption .fadeInDown-3").stop().delay(800).animate({ opacity: 0, top: "-15px" }, { duration: 400, easing: "easeInCubic" }); } else { $(owlElementID + " .caption .fadeInDown-1, " + owlElementID + " .caption .fadeInDown-2, " + owlElementID + " .caption .fadeInDown-3").css({ opacity: 0, top: "-15px" }); } } function fadeInUpReset() { if (!dragging) { $(owlElementID + " .caption .fadeInUp-1, " + owlElementID + " .caption .fadeInUp-2, " + owlElementID + " .caption .fadeInUp-3").stop().delay(800).animate({ opacity: 0, top: "15px" }, { duration: 400, easing: "easeInCubic" }); } else { $(owlElementID + " .caption .fadeInUp-1, " + owlElementID + " .caption .fadeInUp-2, " + owlElementID + " .caption .fadeInUp-3").css({ opacity: 0, top: "15px" }); } } function fadeInLeftReset() { if (!dragging) { $(owlElementID + " .caption .fadeInLeft-1, " + owlElementID + " .caption .fadeInLeft-2, " + owlElementID + " .caption .fadeInLeft-3").stop().delay(800).animate({ opacity: 0, left: "50px" }, { duration: 400, easing: "easeInCubic" }); } else { $(owlElementID + " .caption .fadeInLeft-1, " + owlElementID + " .caption .fadeInLeft-2, " + owlElementID + " .caption .fadeInLeft-3").css({ opacity: 0, left: "50px" }); } } function fadeInRightReset() { if (!dragging) { $(owlElementID + " .caption .fadeInRight-1, " + owlElementID + " .caption .fadeInRight-2, " + owlElementID + " .caption .fadeInRight-3").stop().delay(800).animate({ opacity: 0, left: "-50px" }, { duration: 400, easing: "easeInCubic" }); } else { $(owlElementID + " .caption .fadeInRight-1, " + owlElementID + " .caption .fadeInRight-2, " + owlElementID + " .caption .fadeInRight-3").css({ opacity: 0, left: "-50px" }); } } function fadeIn() { $(owlElementID + " .active .caption .fadeIn-1").stop().delay(500).animate({ opacity: 1 }, { duration: 800, easing: "easeOutCubic" }); $(owlElementID + " .active .caption .fadeIn-2").stop().delay(700).animate({ opacity: 1 }, { duration: 800, easing: "easeOutCubic" }); $(owlElementID + " .active .caption .fadeIn-3").stop().delay(1000).animate({ opacity: 1 }, { duration: 800, easing: "easeOutCubic" }); } function fadeInDown() { $(owlElementID + " .active .caption .fadeInDown-1").stop().delay(500).animate({ opacity: 1, top: "0" }, { duration: 800, easing: "easeOutCubic" }); $(owlElementID + " .active .caption .fadeInDown-2").stop().delay(700).animate({ opacity: 1, top: "0" }, { duration: 800, easing: "easeOutCubic" }); $(owlElementID + " .active .caption .fadeInDown-3").stop().delay(1000).animate({ opacity: 1, top: "0" }, { duration: 800, easing: "easeOutCubic" }); } function fadeInUp() { $(owlElementID + " .active .caption .fadeInUp-1").stop().delay(500).animate({ opacity: 1, top: "0" }, { duration: 800, easing: "easeOutCubic" }); $(owlElementID + " .active .caption .fadeInUp-2").stop().delay(700).animate({ opacity: 1, top: "0" }, { duration: 800, easing: "easeOutCubic" }); $(owlElementID + " .active .caption .fadeInUp-3").stop().delay(1000).animate({ opacity: 1, top: "0" }, { duration: 800, easing: "easeOutCubic" }); } function fadeInLeft() { $(owlElementID + " .active .caption .fadeInLeft-1").stop().delay(500).animate({ opacity: 1, left: "0" }, { duration: 800, easing: "easeOutCubic" }); $(owlElementID + " .active .caption .fadeInLeft-2").stop().delay(700).animate({ opacity: 1, left: "0" }, { duration: 800, easing: "easeOutCubic" }); $(owlElementID + " .active .caption .fadeInLeft-3").stop().delay(1000).animate({ opacity: 1, left: "0" }, { duration: 800, easing: "easeOutCubic" }); } function fadeInRight() { $(owlElementID + " .active .caption .fadeInRight-1").stop().delay(500).animate({ opacity: 1, left: "0" }, { duration: 800, easing: "easeOutCubic" }); $(owlElementID + " .active .caption .fadeInRight-2").stop().delay(700).animate({ opacity: 1, left: "0" }, { duration: 800, easing: "easeOutCubic" }); $(owlElementID + " .active .caption .fadeInRight-3").stop().delay(1000).animate({ opacity: 1, left: "0" }, { duration: 800, easing: "easeOutCubic" }); } $(owlElementID).owlCarousel({ autoPlay: 4000, stopOnHover: true, navigation: true, pagination: true, singleItem: true, addClassActive: true, transitionStyle: "fade", navigationText: ["", ""], afterInit: function() { fadeIn(); fadeInDown(); fadeInUp(); fadeInLeft(); fadeInRight(); }, afterMove: function() { fadeIn(); fadeInDown(); fadeInUp(); fadeInLeft(); fadeInRight(); }, afterUpdate: function() { fadeIn(); fadeInDown(); fadeInUp(); fadeInLeft(); fadeInRight(); }, startDragging: function() { dragging = true; }, afterAction: function() { fadeInReset(); fadeInDownReset(); fadeInUpReset(); fadeInLeftReset(); fadeInRightReset(); dragging = false; } }); $(".owlbg").css({ backgroundSize: "cover" }); /*========================================*/ /* info-wrapper /*========================================*/ var owl = $("#info-carousel"); owl.owlCarousel({ items : 3, itemsDesktop : [1199,2], itemsDesktopSmall : [991,2], itemsTablet: [767,1], itemsMobile : [479, 1] }); $("#info-carousel .item-left").css({ backgroundSize: "cover" }); $(function () { $('#info-collapse').metisMenu(); }); /*========================================*/ /* recent-warpper /*========================================*/ var owl = $("#recent1-carousel"); owl.owlCarousel({ items : 2, itemsDesktop : [1199,2], itemsDesktopSmall : [991,2], itemsTablet: [767,1], itemsMobile : [479, 1] }); var owl = $("#recent2-carousel"); owl.owlCarousel({ items : 2, itemsDesktop : [1199,2], itemsDesktopSmall : [991,2], itemsTablet: [767,1], itemsMobile : [479, 1] }); /*========================================*/ /* parallax-warpper /*========================================*/ (function( $ ){ var $window = $(window); var windowHeight = $window.height(); $window.resize(function () { windowHeight = $window.height(); }); $.fn.parallax = function(xpos, speedFactor, outerHeight) { var $this = $(this); var getHeight; var firstTop; var paddingTop = 0; //get the starting position of each element to have parallax applied to it $this.each(function(){ firstTop = $this.offset().top; }); if (outerHeight) { getHeight = function(jqo) { return jqo.outerHeight(true); }; } else { getHeight = function(jqo) { return jqo.height(); }; } // setup defaults if arguments aren't specified if (arguments.length < 1 || xpos === null) xpos = "50%"; if (arguments.length < 2 || speedFactor === null) speedFactor = 0.1; if (arguments.length < 3 || outerHeight === null) outerHeight = true; // function to be called whenever the window is scrolled or resized function update(){ var pos = $window.scrollTop(); $this.each(function(){ var $element = $(this); var top = $element.offset().top; var height = getHeight($element); // Check if totally above or totally below viewport if (top + height < pos || top > pos + windowHeight) { return; } $this.css('backgroundPosition', xpos + " " + Math.round((firstTop - pos) * speedFactor) + "px"); }); } $window.bind('scroll', update).resize(update); update(); }; })(jQuery); $('#parallax-wrapper').parallax("80%", 0.1); $("#parallax-wrapper").css({ backgroundSize: "cover" }); /*========================================*/ /* toTop /*========================================*/ $.fn.scrollToTop = function(options) { var config = { "speed" : 800 }; if (options) { $.extend(config, { "speed" : options }); } return this.each(function() { var $this = $(this); $(window).scroll(function() { if ($(this).scrollTop() > 100) { $this.fadeIn(); } else { $this.fadeOut(); } }); $this.click(function(e) { e.preventDefault(); $("body, html").animate({ scrollTop : 0 }, config.speed); }); }); }; $(function() { $("#toTop").scrollToTop(1000); }); $("#info-carousel .item-center").css({ backgroundSize: "cover" }); });