(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(); // histroylinepic() // histroyline() /*---------------------------------------- burger menu ----------------------------------------*/ function histroylinepic(){ var height= $('.slider_pic_bg').height() var width= $('#slider_pic').width() $('.prevbtnpic').height(height) $('.nextbtnpic').height(height) $('.historylineweb').height(height) $('.rd_01').width(width/6-1) } function histroyline(){ var slider_picw=parseint($('#slider_pic').width()) var rd_01w=$('.rd_01').width() var opic = $('#slider_pic').find('ul'); var oimg = opic.find('li'); var olen = oimg.length / 6; var oli = oimg.width(); var prev = $("#prev"); var next = $("#next"); opic.width(rd_01w*$('#slider_pic').find('ul').find('li').length); //计算总长度 var inow = 0; var itimer = null; prev.click(function () { if (inow > 0) { inow--; } clickscroll(); }) next.click(function () { if (inow < olen - 1) { inow++; clickscroll(); } }) function clickscroll() { inow == 0 ? prev.addclass('no_click') : prev.removeclass('no_click'); inow == olen ? next.addclass("no_click") : next.removeclass("no_click"); inow == 0 ? prev.addclass('xt_click') : prev.removeclass('xt_click'); inow == olen ? next.addclass("xt_click") : next.removeclass("xt_click"); if (inow == 0) { opic.animate({ left: inow * slider_picw }) } else { opic.animate({ left: -inow * slider_picw }) } } } 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() histroylinepic() histroyline() } 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));