(function($) { function handlepreloader() { if ($(".preloader").length) { $(".preloader").delay(200).fadeout(500) } } function headerstyle() { if ($(".main-header").length) { var windowpos = $(window).scrolltop(); var siteheader = $(".main-header"); var sticky_header = $(".main-header .sticky-header"); var scrolllink = $(".scroll-to-top"); if (windowpos > 100) { siteheader.addclass("fixed-header"); sticky_header.addclass("animated slideindown"); scrolllink.fadein(300) } else { siteheader.removeclass("fixed-header"); sticky_header.removeclass("animated slideindown"); scrolllink.fadeout(300) } } } headerstyle(); if ($(".main-header li.dropdown ul").length) { $(".main-header .navigation li.dropdown").append(''); $(".main-header .navigation li.dropdown .dropdown-btn").on("click", function() { $(this).prev("ul").slidetoggle(500) }); $(".main-header .navigation li.dropdown > a").on("click", function(e) { e.preventdefault() }) } if ($("#search-popup").length) { $(".search-box-btn").on("click", function() { $("#search-popup").addclass("popup-visible") }); $(document).keydown(function(e) { if (e.keycode == 27) { $("#search-popup").removeclass("popup-visible") } }); $(".close-search,.search-popup .overlay-layer").on("click", function() { $("#search-popup").removeclass("popup-visible") }) } if ($(".mobile-menu").length) { var mobilemenucontent = $(".main-header .nav-outer .main-menu .navigation").html(); $(".mobile-menu .navigation").append(mobilemenucontent); $(".sticky-header .navigation").append(mobilemenucontent); $(".mobile-menu .close-btn").on("click", function() { $("body").removeclass("mobile-menu-visible") }); $(".mobile-menu li.dropdown .dropdown-btn").on("click", function() { $(this).prev("ul").slidetoggle(500) }); $(".mobile-nav-toggler").on("click", function() { $("body").addclass("mobile-menu-visible") }); $(".mobile-menu .menu-backdrop,.mobile-menu .close-btn").on("click", function() { $("body").removeclass("mobile-menu-visible") }) } function home_carousel() { var owl = $(".home-carousel"); owl.owlcarousel({ loop: true, margin: 0, nav: true, dots: true, animateout: "fadeout", animatein: "fadein", active: true, autoplay: true, smartspeed: 1000, autoplaytimeout: 8000, navtext: ["", ""], responsive: { 0: { items: 1 }, 425: { items: 1 }, 768: { items: 1 }, 1024: { items: 1 }, 1440: { items: 1 } } }) } home_carousel(); function testimonial_items_1col() { var owl = $(".testimonial-items-1col"); owl.owlcarousel({ loop: true, margin: 30, autoplay: true, autoplaytimeout: 5000, nav: false, dots: true, navtext: ["", ""], responsive: { 0: { items: 1 }, 425: { items: 1 }, 768: { items: 1 }, 1024: { items: 1 }, 1440: { items: 1 } } }) } testimonial_items_1col(); function testimonial_items_2col() { var owl = $(".testimonial-items-2col"); owl.owlcarousel({ loop: true, margin: 30, autoplay: true, autoplaytimeout: 8000, nav: true, dots: false, navtext: ["", ""], responsive: { 0: { items: 1 }, 425: { items: 1 }, 768: { items: 1 }, 1024: { items: 1 }, 1440: { items: 1 } } }) } testimonial_items_2col(); /*------------- [_testimonial_items_3col] ------*/ function testimonial_items_3col() { var owl = $(".testimonial-items-3col"); owl.owlcarousel({ loop: true, margin: 30, autoplay: false, autoplaytimeout: 8000, nav: true, dots: false, navtext: ["", ""], responsive: { 0: { items: 1 }, 425: { items: 1 }, 768: { items: 2 }, 1024: { items: 2 }, 1440: { items: 3 } } }); } testimonial_items_3col(); function team_items_3col() { var owl = $(".team-items-3col"); owl.owlcarousel({ loop: false, margin: 30, autoplay: true, autoplaytimeout: 8000, nav: true, dots: false, navtext: ["", ""], responsive: { 0: { items: 1 }, 425: { items: 1 }, 768: { items: 2 }, 1024: { items: 3 }, 1440: { items: 3 } } }) } team_items_3col(); // testimonial carousel if ($('.testimonial-carousel').length) { $('.testimonial-carousel').owlcarousel({ animateout: 'slideoutdown', animatein: 'fadein', loop: true, margin: 10, nav: true, singleitem: true, smartspeed: 500, autoheight: false, autoplay: false, autoplaytimeout: 10000, navtext: ['', ''], responsive: { 0: { items: 1 }, 600: { items: 2 }, 800: { items: 2 }, 1024: { items: 3 }, 1300: { items: 4 }, 1920: { items: 4 } } }); } // img var imgs = $("img"); imgs.on("contextmenu", function() { return false }); imgs.on("dragstart", function() { return false }); // 禁止右击 // function stop() { // return false; // } // document.oncontextmenu = stop; $(".language-btn").on("click", function(event) { event.preventdefault(); $(this).next(".language-dropdown").toggleclass("open") }); var sectionbgimg = $(".bg-img, .footer, section, div"); sectionbgimg.each(function(indx) { if ($(this).attr("data-background")) { $(this).css("background-image", "url(" + $(this).data("background") + ")") } }); if ($(".timepicker").length) { $(".timepicker").timepicker() } if ($(".progress-levels .progress-box .bar-fill").length) { $(".progress-box .bar-fill").each(function() { $(".progress-box .bar-fill").appear(function() { var progresswidth = $(this).attr("data-percent"); $(this).css("width", progresswidth + "%") }) }, { accy: 0 }) } if ($(".filter-list").length) { $(".filter-list").mixitup({}) } if ($(".lightbox-image").length) { $(".lightbox-image").fancybox({ openeffect: "fade", closeeffect: "fade", helpers: { media: {} } }) } if ($("#contact-form").length) { $("#contact-form").validate({ rules: { username: { required: true }, email: { required: true, email: true }, subject: { required: true }, message: { required: true } } }) } if ($(".scroll-to-target").length) { $(".scroll-to-target").on("click", function() { var target = $(this).attr("data-target"); $("html, body").animate({ scrolltop: $(target).offset().top }, 1500) }) } $(".popup-load").magnificpopup({ type: "iframe", gallery: { enabled: true } }); $(".img-popup").magnificpopup({ type: "image", gallery: { enabled: true } }); $(".popup-youtube, .popup-youtube-left, .popup-vimeo, .popup-gmaps").magnificpopup({ type: "iframe", mainclass: "mfp-fade", removaldelay: 160, preloader: false, fixedcontentpos: false }); $("#container").imagesloaded(function() { $(".project-filter").on("click", "li", function() { $("li").removeclass("active"); $(this).addclass("active"); var filtervalue = $(this).attr("data-filter"); $grid.isotope({ filter: filtervalue }) }); var $grid = $(".grid").isotope({ itemselector: ".grid-item", percentposition: true, transitionduration: ".6s" }) }); if ($(".wow").length) { var wow = new wow({ boxclass: "wow", animateclass: "animated", offset: 0, mobile: false, live: true }); wow.init() } $(window).on("scroll", function() { headerstyle() }); $(window).on("load", function() { handlepreloader() }) })(window.jquery); $(function() { var accordion = function(el, multiple) { this.el = el || {}; this.multiple = multiple || false; var links = this.el.find(".link"); links.on("click", { el: this.el, multiple: this.multiple }, this.dropdown) }; accordion.prototype.dropdown = function(e) { var $el = e.data.el; $this = $(this); $next = $this.next(); $next.slidetoggle(); $this.parent().toggleclass("open"); if (!e.data.multiple) { $el.find(".submenu").not($next).slideup().parent().removeclass("open") } }; var accordion = new accordion($("#accordion"), false); $(".submenu li").click(function() { $(this).addclass("current").siblings("li").removeclass("current") }) });