$(function() { var nav = $('#header'), doc = $(document), win = $(window); win.scroll(function() { if(doc.scrollTop() > 80) { nav.addClass('scrolled'); } else { nav.removeClass('scrolled'); } }); win.scroll(); }); /*----*/ /*----**/ $(function() { $('a.golink').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) { var targetOffset = $target.offset().top - 90; $('html,body').animate({ scrollTop: targetOffset }, 500); return false; } } }); }) /*-----*/ new WOW().init(); var wow = new WOW({ boxClass: 'sxch', animateClass: 'animated', offset: 0, mobile: true, live: true }); wow.init(); // $(function() { $(".subNav").click(function() { $(this).toggleClass("currentDt").siblings(".subNav").removeClass("currentDt"); $(this).next(".sunNav").slideToggle(300).siblings(".sunNav").slideUp(500); }) $(".top-language").hover(function() { $(".top-language ul").toggleClass("show").siblings(".top-language ul").removeClass("show"); $(".top-print").toggleClass("move").siblings(".top-print").removeClass("move"); $(".top-search-btn").toggleClass("move").siblings(".top-search-btn").removeClass("move"); $(".top-shop").toggleClass("move").siblings(".top-shop").removeClass("move"); }) $(".top-search-div").mouseleave(function() { setTimeout(function() { $(".top-search-div.show").removeClass("show") }, 1000); }) $(".top-search-btn").click(function() { $(".top-search-div").toggleClass("show").siblings(".top-search-div").removeClass("show"); }) $(".golink").click(function() { $(".all-cate").removeClass("show"); }) $(".navbar-toggle").click(function() { $(this).toggleClass("closed").siblings(this).removeClass("closed"); }) $(".nav>li:nth-child(2)").hover(function() { $(".ul-cont").toggleClass("show").siblings(".ul-cont").removeClass("show"); }) $(".nav>li:nth-child(3)").hover(function() { $(".ul-cont").toggleClass("show2").siblings(".ul-cont").removeClass("show2"); }) $(".nav>li:nth-child(4)").hover(function() { $(".ul-cont").toggleClass("show").siblings(".ul-cont").removeClass("show"); }) $(".nav>li:nth-child(5)").hover(function() { $(".ul-cont").toggleClass("show").siblings(".ul-cont").removeClass("show"); }) $(".nav>li:nth-child(6)").hover(function() { $(".ul-cont").toggleClass("show").siblings(".ul-cont").removeClass("show"); }) $(".nav>li:nth-child(7)").hover(function() { $(".ul-cont").toggleClass("show").siblings(".ul-cont").removeClass("show"); }) // $(".xunpan-cont").hover(function() { // $(".xunpan-cont").toggleClass("hh").siblings(".xunpan-cont").removeClass("hh"); // }) $(".nav>li>i").click(function() { $($(this).next()).toggleClass("show").siblings($($(this).next())).removeClass("show"); }) $('.p-tab').Tabs(); }) ///返回顶部 jQuery(document).ready(function($){ // browser window scroll (in pixels) after which the "back to top" link is shown var offset = 300, //browser window scroll (in pixels) after which the "back to top" link opacity is reduced offset_opacity = 1200, //duration of the top scrolling animation (in ms) scroll_top_duration = 700, //grab the "back to top" link $back_to_top = $('.cd-top'); //hide or show the "back to top" link $(window).scroll(function(){ ( $(this).scrollTop() > offset ) ? $back_to_top.addClass('cd-is-visible') : $back_to_top.removeClass('cd-is-visible cd-fade-out'); if( $(this).scrollTop() > offset_opacity ) { $back_to_top.addClass('cd-fade-out'); } }); //smooth scroll to top $back_to_top.on('click', function(event){ event.preventDefault(); $('body,html').animate({ scrollTop: 0 , }, scroll_top_duration ); }); });