$(function(){ //ie兼容filter,indexof if (!array.prototype.filter) { array.prototype.filter = function(fun /*, thisp */) { "use strict"; if (this === void 0 || this === null) throw new typeerror(); var t = object(this); var len = t.length >>> 0; if (typeof fun !== "function") throw new typeerror(); var res = []; var thisp = arguments[1]; for (var i = 0; i < len; i++) { if (i in t) { var val = t[i]; // in case fun mutates this if (fun.call(thisp, val, i, t)) res.push(val); } } return res; }; } if (!array.prototype.indexof){ array.prototype.indexof = function(elt /*, from*/){ var len = this.length >>> 0; var from = number(arguments[1]) || 0; from = (from < 0) ? math.ceil(from) : math.floor(from); if (from < 0) from += len; for (; from < len; from++){ if (from in this && this[from] === elt) return from; } return -1; }; } //在ie6,7,8,9没有页面滚动动画 if (!(/msie [6|7|8|9]/i.test(navigator.useragent))){ new wow().init(); }; //导航 $(".nav li").hover(function () { $(this).find(".nav_child").stop(false,true).slidedown(0); if($(this).find('.nav_child').length > 0){ $(this).addclass('on').siblings().removeclass('on'); } },function () { $(this).find(".nav_child").stop(false,true).slideup(0); $(this).removeclass('on'); }); // headertop(); // function headertop(){ // $(window).scroll(function (){ // if($(this).scrolltop() > 50){ // $(".header").addclass('on'); // }else{ // $(".header").removeclass('on'); // } // }); // } //banner大图轮播 $(".banner").slick({ dots:true,//指示点 arrows:false, infinite:false, autoplay:true, autoplayspeed:5000, fade:true, }); $(".act_slider").slick({ dots:false,//指示点 arrows:true, infinite:false, // autoplay:true, // autoplayspeed:5000, fade:true, }); //返回顶部 scrolltop(); function scrolltop(){ $(window).scroll(function (){ if($(this).scrolltop() > 50){ $(".scrolltop").addclass('on'); }else{ $(".scrolltop").removeclass('on'); } }); } $(".scrolltop").click(function () { $('body,html').animate({scrolltop:'0px'},500) }); //案例 $('.secthree_slider').slick({ slidestoshow:1, slidetoscroll:1, dots:false, arrows:false, infinite: false, responsive: [ { breakpoint: 992, settings: { dots:true, } }] }); //资质证书 $('.secfour_slider').slick({ slidestoshow:4, slidetoscroll:4, dots:false, arrows:false, infinite: false, responsive: [ { breakpoint: 992, settings: { slidestoshow:2, slidetoscroll:2, dots:true, } }, { breakpoint: 768, settings: { slidestoshow:1, slidetoscroll:1, dots:true, infinite: true, centermode:true, centerpadding: "18%" } }] }); //文字滚动类 function textslider(args){ for(var i in args){ this[i] = args[i]; } this.speed = args.speed ? args.speed : 50; this.direction = args.direction ? args.direction : "top"; this.load(); this.start(); } textslider.prototype = { constructor : this, load: function(){ var _this = this; if(this.direction == "left"){//left的浮动处理 var child = this.inner.children(); childwidth = child.width() + parseint(child.css("border-left-width")) + parseint(child.css("border-right-width"))+parseint(child.css("margin-left"))+parseint(child.css("margin-right")); this.inner.css({ "width" : childwidth*child.length, "float" : "left" }); this.inner.parent().css("width",this.inner.width()*2); } this.inner.clone(true).appendto(this.inner.parent()); this.outer.hover(function(){ _this.stop(); },function(){ _this.start(); }); }, start : function(){ var _this = this; if(this.direction == "top"){ this.inter = setinterval(function(){ var _top = _this.outer.scrolltop()+1; if(_top > _this.inner.height()){ _top = 0; } _this.outer.scrolltop(_top); },this.speed); }else{ this.inter = setinterval(function(){ var _left = _this.outer.scrollleft()+1; if(_left > _this.inner.width()){ _left = 0; } _this.outer.scrollleft(_left); },this.speed); } }, stop : function(){ if(this.inter){ clearinterval(this.inter); } } }; window.textslider = textslider; //文字滚动类 if($(".secfive_contpc .secthree_list").length>=4){ new textslider({ outer : $(".secfive_contpc"), inner : $(".secfive_contpc .box"), direction : "left", speed : 11 }); } //施工现场 $('.secfive_slider').slick({ slidestoshow:4, slidetoscroll:4, dots:false, arrows:false, infinite: false, responsive: [ { breakpoint: 992, settings: { slidestoshow:2, slidetoscroll:2, dots:true, } }, { breakpoint: 768, settings: { slidestoshow:1, slidetoscroll:1, dots:true, infinite: true, centermode:true, centerpadding: "18%" } }] }); //手机底部微信 $(".mobwx_btn").click(function (){ $(".mobwx_model").addclass('on'); }); $(".mobwx_model .bg").click(function (){ $(".mobwx_model").removeclass('on'); }); //手机导航 $(".menu").click('touchstart',function () { $('.left_navbox').addclass('on'); $('html').addclass('on'); }); $(".close_m").click('touchstart',function () { $('.left_navbox').removeclass('on'); $('html').removeclass('on'); }); $("ul.left_nav a").click(function (event) { if ($(this).siblings("ul").length > 0) { var a = $(this); var thisname = a.attr('class'); if (thisname == null || thisname == 0) { a.siblings("ul").slidedown(300); a.parent().siblings().find('ul').slideup(500).siblings("a").removeclass(); var parent = a.parent().parents("ul").attr('class'); switch (parent) { case "left_nav": a.addclass("on"); break; case "left_navone": a.addclass("on"); break; case "left_navtwo": a.addclass("on"); break; } } else { a.removeclass().siblings('ul').slideup(300); a.siblings('ul').find('a').removeclass().siblings('ul').slideup(300); } return false; } }); $("ul.left_nav i").each(function () { if($(this).parent().siblings('ul').length > 0){ $(this).addclass('in'); }else{ $(this).removeclass("in"); } }); //内页分类 $("ul.det_nav a").click(function (event) { if ($(this).siblings("ul").length > 0) { var a = $(this); var thisname = a.attr('class'); if (thisname == null || thisname == 0) { a.siblings("ul").slidedown(300); a.parent().siblings().find('ul').slideup(500).siblings("a").removeclass(); var parent = a.parent().parents("ul").attr('class'); switch (parent) { case "det_nav": a.addclass("on"); break; case "det_navtwo": a.addclass("on"); break; } } else { a.removeclass().siblings('ul').slideup(300); a.siblings('ul').find('a').removeclass().siblings('ul').slideup(300); } return false; } }); $("ul.det_nav i").each(function () { if($(this).parent().siblings('ul').length > 0){ $(this).addclass('in'); }else{ $(this).removeclass("in"); } }); $(".classify").click(function () { $(this).toggleclass('on') $(".det_nav").stop(false,true).slidetoggle(); }); //产品详情 $('.prod_slider').slick({ arrows:true, infinite: false, dots: false, responsive: [ { breakpoint: 768, settings: { dots:true, arrows:false } }] }); //brand $('.brthree_slider .slider-for').slick({ slidestoshow:1, slidestoscroll:1, arrows:false, infinite: false, asnavfor:'.brthree_slider .slider-nav' }); $('.brthree_slider .slider-nav').slick({ slidestoshow:6, slidetoscroll:1, asnavfor:'.brthree_slider .slider-for', dots:false, arrows:true, vertical:true, infinite: false, focusonselect:true, responsive: [ { breakpoint: 992, settings: { slidestoshow: 5, slidestoscroll: 1 } }, { breakpoint: 767, settings: { vertical:false, slidestoshow: 5, slidestoscroll: 1 } }] }); //xz $('.xztwo_contpc .xztwo_list').hover(function (){ $(this).addclass('on').siblings().removeclass('on'); }); $('.xztwo_contmob .xztwo_cont .xztwo_list').click(function (){ var contindex = $(this).index(); $(".xztwo_contmob .xztwo_for .xztwo_list").eq(contindex).addclass('cur').siblings().removeclass('cur'); }); $('.xzthree_slider .slider-for').slick({ slidestoshow:1, slidestoscroll:1, arrows:true, infinite: true, asnavfor:'.xzthree_slider .slider-nav', centermode:true, centerpadding:'22%', responsive: [ { breakpoint: 992, settings: { centermode:false, arrows:false, infinite: false, } }] }); $('.xzthree_slider .slider-nav').slick({ slidestoshow:6, slidetoscroll:1, asnavfor:'.xzthree_slider .slider-for', dots:false, arrows:false, infinite: true, focusonselect:true, responsive: [ { breakpoint: 992, settings: { infinite: false, } }] }); //pro $(".pro_slider").slick({ dots:true, arrows:false, infinite:false, // autoplay:true, // autoplayspeed:5000 }); });