(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));