(function ($) { $('.tabchangeone').on('mouseenter', function () {//绑定鼠标进入事件 $(this).siblings('.taboneon').removeClass('taboneon') $(this).addClass('taboneon') $('.onebox').show() $('.twobox').hide() }); $('.tabchangetwo').on('mouseenter', function () {//绑定鼠标进入事件 $(this).siblings('.taboneon').removeClass('taboneon') $(this).addClass('taboneon') $('.onebox').hide() $('.twobox').show() }); $('.tabtwochangeone').on('mouseenter', function () {//绑定鼠标进入事件 $(this).siblings('.tabtwoon').removeClass('tabtwoon') $(this).addClass('tabtwoon') $('.tabtwo-one').show() $('.tabtwo-two').hide() }); $('.tabtwochangetwo').on('mouseenter', function () {//绑定鼠标进入事件 $(this).siblings('.tabtwoon').removeClass('tabtwoon') $(this).addClass('tabtwoon') $('.tabtwo-one').hide() $('.tabtwo-two').show() }); var time = 7; // time in seconds $(".homepage-slider").owlCarousel({ autoPlay: true, slideSpeed: 500, singleItem: true, pagination: true, touchDrag: true, stopOnHover: true, }); $(".customer-slider").owlCarousel({ autoPlay: true, slideSpeed: 500, singleItem: true, pagination: true, touchDrag: true, stopOnHover: true, }); $(".picnews-slider").owlCarousel({ autoPlay: true, slideSpeed: 500, singleItem: true, touchDrag: true, navigation: true, pagination: false, navigationText: ["", ""] }); $(".videonews-slider").owlCarousel({ autoPlay: true, slideSpeed: 500, singleItem: true, touchDrag: true, navigation: true, pagination: false, navigationText: ["", ""] }); $(document).ready(function () { $(document).on('click', ".onlinebtn", function () { $('.onlineservicebox').toggle(); }) /*------------------ 返回顶部 ------------------*/ $(document).on('click', '.back-to-top', function () { $("html,body").animate({ scrollTop: 0 }, 1000); }); mobileMenuControl(); /*---------------------------------------- Burger Menu ----------------------------------------*/ function mobileMenuControl() { // click burger menu $('.probootstrap-burger-menu').on('click', function (e) { e.preventDefault(); if ($('body').hasClass('show')) { $('.probootstrap-burger-menu').removeClass('active'); $('body').removeClass('show'); } else { $('.probootstrap-burger-menu').addClass('active'); $('body').addClass('show'); } }); if ($(window).width() >= 992) {//宽屏 $('body').removeClass('probootstrap-mobile-menu-active'); $('.probootstrap-burger-menu').removeClass('active'); menuslider() changepicweb() } else { $('body').addClass('probootstrap-mobile-menu-active'); changepicmobile() } $(window).resize(function () { if ($(window).width() >= 992) {//宽屏 $('body').removeClass('probootstrap-mobile-menu-active'); $('.probootstrap-burger-menu').removeClass('active'); menuslider(); changepicweb(); } else { $('body').addClass('probootstrap-mobile-menu-active'); changepicmobile(); } }); $(document).click(function (e) { var container = $(".probootstrap-nav, .probootstrap-burger-menu"); if (!container.is(e.target) && container.has(e.target).length === 0) { if ($('body').hasClass('show')) { $('body').removeClass('show'); $('.probootstrap-burger-menu').removeClass('active'); } } }); }; function menuslider() { var ww = $('#nav').width() / 9 var cindex = $("#nav li.current").index("#nav li") var initleftw = ww * cindex $('#lavalamp').css('left', initleftw + 'px') $('#nav li').hover(function () { var index = $("#nav li").index(this) var leftw = ww * index $('#lavalamp').css('left', leftw + 'px') }) $('#nav').hover(function () { }, function () { $('#lavalamp').css('left', initleftw + 'px') }) } function changepicmobile() { $(".homepage-slider").find('img').each(function () { $(this).attr("src", $(this).attr("src").replace("Images/webbanner/", "Images/mobilebanner/")); }); } function changepicweb() { $(".homepage-slider").find('img').each(function () { $(this).attr("src", $(this).attr("src").replace("Images/mobilebanner/", "Images/webbanner/")); }); } }) $(window).on('scroll', function () { //返回顶部 show/hide var winH = $(window).height(); // console.log(winH); var ScrollTop = $('.back-to-top'); if ($(window).scrollTop() > winH) { ScrollTop.fadeIn(1000); } else { ScrollTop.fadeOut(1000); } }); $(window).on('load', function () { /*----------------- 返回顶部 ------------------*/ var backtoTop = $('.back-to-top') backtoTop.fadeOut(); }); }(jQuery));