$(function () { //定位当前页面在导航上的位置 $('.nav-menu > li').hover(function () { $(this).siblings().removeClass('active') $(this).addClass('active') }, function () { $(this).parent().find('li').removeClass('active') $('.nav-menu > li > a[href="' + location.href + '"]').parent().addClass('active') }) $('.nav-menu > li > a[href="' + location.href + '"]').parent().addClass('active') //顶部新闻滚动 $(".font_inner li:eq(0)").clone(true).appendTo($(".font_inner"));//克隆第一个放到最后(实现无缝滚动) var liHeight = $(".swiper_wrap").height();//一个li的高度 //获取li的总高度再减去一个li的高度(再减一个Li是因为克隆了多出了一个Li的高度) var totalHeight = ($(".font_inner li").length * $(".font_inner li").eq(0).height()) - liHeight; $(".font_inner").height(totalHeight);//给ul赋值高度 var index = 0; var autoTimer = 0;//全局变量目的实现左右点击同步 var clickEndFlag = true; //设置每张走完才能再点击 function tab() { $(".font_inner").stop().animate({ top: -index * liHeight }, 400, function () { clickEndFlag = true;//图片走完才会true if (index == $(".font_inner li").length - 1) { $(".font_inner").css({top: 0}); index = 0; } }) } function next() { index++; if (index > $(".font_inner li").length - 1) {//判断index为最后一个Li时index为0 index = 0; } tab(); } function prev() { index--; if (index < 0) { index = $(".font_inner li").size() - 2;//因为index的0 == 第一个Li,减二是因为一开始就克隆了一个LI在尾部也就是多出了一个Li,减二也就是_index = Li的长度减二 $(".font_inner").css("top", -($(".font_inner li").size() - 1) * liHeight);//当_index为-1时执行这条,也就是走到li的最后一个 } tab(); } //切换到下一张 $(".swiper_wrap .gt").on("click", function () { if (clickEndFlag) { next(); clickEndFlag = false; } }); //切换到上一张 $(".swiper_wrap .lt").on("click", function () { if (clickEndFlag) { prev(); clickEndFlag = false; } }); //自动轮播 autoTimer = setInterval(next, 3000); $(".font_inner a").hover(function () { clearInterval(autoTimer); }, function () { autoTimer = setInterval(next, 3000); }) //鼠标放到左右方向时关闭定时器 $(".swiper_wrap .lt,.swiper_wrap .gt").hover(function () { clearInterval(autoTimer); }, function () { autoTimer = setInterval(next, 3000); }) //1文字轮播(2-5页中间)结束 //banner滚动 $('.banner').bxSlider({ mode: 'fade', slideWidth: 1920, slideMargin: 10, auto: true, controls: false }); //产品滚动 $('.product-scroll').bxSlider({ slideWidth: 220, minSlides: 2, maxSlides: 4, moveSlides: 1, slideMargin: 10, auto: true, pager: false, controls: false }); //案例滚动 $('.case-scroll').bxSlider({ slideWidth: 180, minSlides: 2, maxSlides: 6, moveSlides: 3, slideMargin: 10, auto: true, pager: false, controls: false }); //案例滚动 $('.info-product-image').bxSlider({ mode: 'fade', slideWidth: 1920, slideMargin: 10, auto: true, controls: false }); }) /*导航*/ $('#nav .nav li.list').hover(function() { $(this).find('.list_ul').show(); $('.fullscreen_list_div').hide(); }, function() { $(this).find('.list_ul').hide(); }) $('.nav > li.list .list_ul > li').hover(function() { $(this).find('ul.list_children').show(); }, function() { $(this).find('ul.list_children').hide(); }) $('.fullscreen_list').hover(function() { $('.fullscreen_list_div').show(); }, function() { $('.fullscreen_list_div').hide(); }) $('.fullscreen_list_div').hover(function() { $('.fullscreen_list_div').show(); }, function() { $('.fullscreen_list_div').hide(); }); //toolbar1 $(function(){ /(iPhone|iPad|iPhone OS|Phone|iPod|iOS)/i.test(navigator.userAgent) && (head = document.getElementsByTagName("head"), viewport = document.createElement("meta"), viewport.name = "viewport", viewport.content = "target-densitydpi=device-dpi, width=1200px, user-scalable=no", head.length > 0 && head[head.length - 1].appendChild(viewport)); toolbar();//右侧悬浮 String.prototype.trim = function () { return this.replace(/^\s\s*/, '').replace(/\s\s*$/, ''); } }); //toolbar function toolbar(){ $('#toolbar dd').bind({ 'mouseenter': function () { if ($(this).children('.slide').length) { var _this = $(this).children('.slide'); _this.stop(true, true).animate({ 'width': 180 }, 200); } else if ($(this).children('.pop').length) { var _this = $(this).children('.pop'); _this.show().animate({ 'right': 65 }, 180); } }, 'mouseleave': function () { if ($(this).children('.slide').length) { var _this = $(this).children('.slide'); _this.stop(false, false).animate({ 'width': 0 }, 200); } else if ($(this).children('.pop').length) { var _this = $(this).children('.pop'); _this.hide().animate({ 'right': 90 },190); } } }); $("#toolbar .tanbtn").click(function(){ $(".dig").show(); layout(1); $('.dig .d_tit').find("b").text($(this).text()); }) $(".dig .icon_close").click(function(){ $(".dig").hide(); layout(0); }) $("#gotop").click(function() { $("body, html").stop().animate({ "scrollTop": 0 }); }); } function share(){ window._bd_share_config = { "common": { "bdSnsKey": {}, "bdText": "", "bdMini": "2", "bdMiniList": false, "bdPic": "", "bdStyle": "0", "bdSize": "16" }, "share": {}, "slide": { // 跟图标式的代码相比,这里是添加了浮窗式 slide 属性配置 "type": "slide", "bdImg": "5", "bdPos": "left", "bdTop": "100" } }; } /*产品*/ var speed1 = 50 deno2.innerHTML = deno1.innerHTML function Marquee1() { if(deno.scrollTop >=deno1.scrollHeight) deno.scrollTop=0; else { deno.scrollTop++ } } var MyMar1 = setInterval(Marquee1, speed1) deno.onmouseover = function() { clearInterval(MyMar1) } deno.onmouseout = function() { MyMar1 = setInterval(Marquee1, speed1) }