$(function () {
var os = function (){
var ua = navigator.useragent,
iswindowsphone = /(?:windows phone)/.test(ua),
issymbian = /(?:symbianos)/.test(ua) || iswindowsphone,
isandroid = /(?:android)/.test(ua),
isfirefox = /(?:firefox)/.test(ua),
ischrome = /(?:chrome|crios)/.test(ua),
istablet = /(?:ipad|playbook)/.test(ua) || (isandroid && !/(?:mobile)/.test(ua)) || (isfirefox && /(?:tablet)/.test(ua)),
isphone = /(?:iphone)/.test(ua) && !istablet,
ispc = !isphone && !isandroid && !issymbian;
return {
istablet: istablet,
isphone: isphone,
isandroid: isandroid,
ispc: ispc
};
}();
if (os.isandroid || os.isphone) {
// alert("手机");
var swiper=new swiper(".swiper-container",{
nextbutton: '.swiper-button-next',
prevbutton: '.swiper-button-prev',
paginationclickable:true,
spacebetween:30,
slidesperview:2,
autoplay: 2500,
autoplaydisableoninteraction: false,
loop: true,
freemode:true, //自由滑动内容
slidespercolumn: 1, //同时显示的行数
});
} else if (os.istablet) {
// alert("平板");
} else if(os.ispc) {
// alert("电脑");
var swiper=new swiper(".swiper-container",{
nextbutton: '.swiper-button-next',
prevbutton: '.swiper-button-prev',
paginationclickable:true,
spacebetween:30,
slidesperview:4,
autoplay: 2500,
autoplaydisableoninteraction: false,
loop: true,
freemode:true, //自由滑动内容
slidespercolumn: 1, //同时显示的行数
});
}
$('#nav_1').addclass('on');
$(".navmenu").mouseover(function(){
$(this).children("ul").show();
})
$(".navmenu").mouseout(function(){
$(this).children("ul").hide();
})
$(".synr2 .xuanx a").click(function(){
})
$('.xialaph .l1').each(function () {
if ($(this).find('.ul2').length < 1) {
$(this).find('h4 b').remove();
} else {
$(this).find('h4 a').attr('href', 'javascript:;');
}
})
// 新闻动态选项卡
$(".xuanx li").css("color","#333").eq(0).css({"background":"#da2827","color":"#fff"})
$(".xinw2").hide().eq(0).show()
$(".xuanx li").click(function(){
//切换当前按钮
$(".xuanx li").css({"background":"none","color":"#333"})
$(this).css({"background":"#da2827","color":"#fff"})
//切换列表
var x = $(this).index('.xuanx li')
console.log(x);
$(".xinw2").hide().eq(x).show()
})
/**
* 加载图片
*/
$("body img").each(function(){
var _this = $(this);
var src = _this.attr('data-src');
if(typeof(src) != 'undefined' && src !=''){
settimeout(function(){
_this.attr('src', src);
}, 5)
}
})
// 新闻动态选项卡
$(".shouji li").css("color","#fff").eq(0).css("color","#da2827")
$(".chanynr4 ul").hide().eq(0).show()
$(".shouji li").click(function(){
//切换当前按钮
$(".shouji li").css("color","#fff")
$(this).css("color","#da2827")
//切换列表
var x = $(this).index()
$(".chanynr4 ul").hide().eq(x).show()
})
$(".index2ul li:first").addclass("on");
//先隐藏菜单,点按钮时再显示菜单,鼠标离开菜单,菜单隐藏
$(".youq_box ul").hide()
$(".youq").click(function(){
$(".youq_box ul").fadetoggle()
})
$(".youq_box ul").mouseleave(function(){
$(this).hide()
})
$(".youq_box2 ul").hide()
$(".youq2").click(function(){
$(".youq_box2 ul").fadetoggle()
})
$(".youq_box2 ul").mouseleave(function(){
$(this).hide()
})
wow = new wow({
boxclass: 'wow',
animateclass: 'animated',
offset: 0,
mobile: false,
live: true
})
wow.init();
//向下滚动 内页
$(".godown2").click(function () {
$("html, body").animate({ scrolltop: $($(this).attr("href")).offset().top + "px" }, 500);
return false;
});
//bottom
$(".bottom2 .bout .h5").click(function () {
$(".bottom2 .bout .scrollbox2").toggleclass("on");
$(this).toggleclass("active");
// sro();
});
//右漂浮
if ($(window).width() < 992) {
$(".fr .list").click(function () {
$(this).find(".ewmbox").toggleclass("active");
})
};
//右漂浮
if ($(window).width() > 992) {
$(".fr").hide()
$(window).scroll(function () {
if ($(window).scrolltop() > 440) {
$('.fr').show();
} else {
$('.fr').hide();
}
});
}
function sro() {
var nicesx = $("#scroll").nicescroll("#scroll .scroll",
{
touchbehavior: false,
cursorcolor: "rgba(0,0,0,0.4)",
cursoropacitymax: 0.8,
cursoropacitymin: 1,
cursorwidth: "6px",
cursorborder: "",
cursorborderradius: "0",
mousescrollstep: "15"
});
// nicesx.checkcontentsize();
}
sro();
$('.slide1').slick({
dots: false,
arrows: true,
speed: 1000,
autoplay: true,
slidestoshow: 1,
slidestoscroll: 1,
autoplayspeed: 4000,
fade: true,
});
writenewdate('.in4ul .time');
$("body").addclass("index")
//首页 banner
$('.slide1').on('beforechange', function (event, slick, currentslide, nextslide) {
var x = $(".slide1 .slick-slide").length;
var y = nextslide + 1;
$(".number").html("0" + y + "" + "/ " + x + "");
});
var x = $(".slide1 .slick-slide").length;
var y = $(".slide1 .slick-active").index() + 1;
$(".number").html("0" + y + "" + "/ " + x + "");
//向下滚动
$(".godown").click(function () {
$("html, body").animate({ scrolltop: $($(this).attr("href")).offset().top + "px" }, 500);
return false;
});
//首页 产品中心
if ($(window).width() < 992) {
$(".index2ul .list").on("touchstart", function () {
$(".index2ul .list").removeclass("on");
$(this).addclass("on");
})
} else {
$(".index2ul .list").on("mouseenter", function () {
$(".index2ul .list").removeclass("on");
$(this).addclass("on");
})
}
if ($(window).width() < 768) {
$(".index2ul .list").removeclass("on");
};
//首页 案例
$('.index3ul').slick({
dots: false,
arrows: true,
slidestoshow: 3,
slidestoscroll: 1,
lazyload: 'progressive',
autoplay: true,
responsive: [
{
breakpoint: 1200,
settings: {
slidestoshow: 2,
slidestoscroll: 1,
dots: true,
arrows: false,
}
},
{
breakpoint: 768,
settings: {
slidestoshow: 1,
slidestoscroll: 1,
dots: true,
arrows: false,
}
}
]
});
//首页 新闻
$(".in4d .list").css("height", "0").eq(0).css("height", "auto");
$(".in4nav .list").eq(0).addclass("on");
$(".in4nav .list").click(function () {
$(this).addclass("on").siblings().removeclass("on");
$(".in4d .list").eq($(this).index()).css("height", "auto").siblings().css("height", "0");
});
//首页 新闻
$('.in4ul').slick({
dots: true,
arrows: false,
slidestoshow: 5,
slidestoscroll: 1,
lazyload: 'progressive',
responsive: [
{
breakpoint: 1600,
settings: {
slidestoshow: 4,
slidestoscroll: 1,
}
},
{
breakpoint: 1200,
settings: {
slidestoshow: 3,
slidestoscroll: 1,
}
},
{
breakpoint: 992,
settings: {
slidestoshow: 2,
slidestoscroll: 1,
}
},
{
breakpoint: 768,
settings: {
slidestoshow: 1,
slidestoscroll: 1,
}
}
]
});
})