$(document).scroll(function(){
if($("div").hasClass("news-titbox")){
var m_top=$(".news-titbox").offset().top;
var top = $(window).scrollTop();
if(m_top || top){
if(top >= m_top){
$(".news-tit0").addClass('fixed');
}else if(top <= m_top){
$(".news-tit0").removeClass('fixed');
}
}
}
});
function hl(id,idx){
$(".header-down .down .items0 .li").eq(id).find(".li-top").addClass('active').siblings('.li-bot').find(".i").eq(idx).addClass('active');
}
function hl0(id,idx){
$(".header-down .down .items1 .li").eq(id).find(".li-top").addClass('active').siblings('.li-bot').find(".i").eq(idx).addClass('active');
}
function titswiper5(id){//服务
var titswiper = new Swiper('.con-titswiper .swiper-container', {
slidesPerView : 4,
breakpoints: {
750: {
slidesPerView: 2.3,
},
1024: {
slidesPerView: 2.8,
},
1180: {
slidesPerView: 3,
}
}
})
$(".con-banner .con-tit .conbox .items").eq(id).addClass("active");
titswiper.slideTo(id, 1000, false);
}
function titswiper(id){//服务
var titswiper = new Swiper('.con-titswiper .swiper-container', {
slidesPerView : 4,
breakpoints: {
750: {
slidesPerView: 2.3,
},
1024: {
slidesPerView: 2.8,
},
1180: {
slidesPerView: 3,
}
}
})
$(".con-banner .con-tit .conbox .items").eq(id).addClass("active");
titswiper.slideTo(id, 1000, false);
}
function titswiper2(id){//服务
var titswiper = new Swiper('.con-titswiper .swiper-container', {
slidesPerView : 4,
breakpoints: {
750: {
slidesPerView: 2.3,
},
1024: {
slidesPerView: 2.8,
},
1180: {
slidesPerView: 3,
}
}
})
$(".con-banner .con-tit .conbox .items").eq(id).addClass("active");
titswiper.slideTo(id, 1000, false);
}
function titswiper3(id){//服务
var titswiper = new Swiper('.con-titswiper .swiper-container', {
slidesPerView : 3,
breakpoints: {
750: {
slidesPerView: 2.3,
},
1024: {
slidesPerView: 2.8,
},
1180: {
slidesPerView: 3,
}
}
})
$(".con-banner .con-tit .conbox .items").eq(id).addClass("active");
titswiper.slideTo(id, 1000, false);
}
function img_abox(id){
$(id).each(function(){
var src= $(this).attr("src");
$(this).wrap("");
$(this).parents("a.abox").attr("href",src)
})
}
// img_abox("img");
function clickVideo(selector){
var video = document.getElementById('video');
selector.on('click',function(){
var videoSrc = $(this).attr('data-src');
console.log(videoSrc);
$('#video').attr('src',videoSrc);
$('.video-fixed').stop().fadeIn();
video.play();
})
$('.video-fixed .cha').on('click',function(){
$('.video-fixed').stop().fadeOut();
video.pause();
})
$(".video-fixed").on("click",function(){
$(".video-fixed").fadeOut();
})
$(".video-fixed .videoboxs").on("click",function(e){
e.stopPropagation()
})
}
function onMouseScroll(e){
var ttop = $(".investment-box").offset().top-160;
var gtop = $(document).scrollTop();
// e.preventDefault();
var wheel = e.originalEvent.wheelDelta || -e.originalEvent.detail;
var delta = Math.max(-1, Math.min(1, wheel) );
var hh = $(".investment-text .item").innerHeight();
if(delta<0){//向下滚动
if(ttop= gtop){
$("html,body").stop().animate({"scrollTop":0}, "500");
return;
}else{
return;
}
}
}
function barken(dataid){
var dataids =$(".flex-left-box").find("a").eq(dataid);
var arrowW=dataids.innerHeight();
var arrowT0=dataids.position().top;
var mt0 =dataids.outerHeight(true) - dataids.outerHeight();
$(".flex-left-box a").eq(dataid).addClass("active");
var line = $('.flex-left-box .bar');
line.stop().animate({
height: arrowW,
top: arrowT0+mt0
});
}
function eachs(ele){
$(ele).each(function(){
var x=" add"+$(this).index()
$(this).addClass(x)
})
}
// 添加 类
function is_weixn(ele){
var ua = navigator.userAgent.toLowerCase();
var u = navigator.userAgent;
var device =""; //当前设备信息
if (u.indexOf('Android') > -1 || u.indexOf('Linux') > -1 ) {//安卓手机
device = "Android";
if(ua.match(/MicroMessenger/i)=="micromessenger") {
$(ele).on("click",function(){
alert("请点击右上角“在浏览器中打开”,发送邮件");
})
return true;
} else {
return false;
}
} else if (u.indexOf('iPhone') > -1) {//苹果手机
device = "iPhone";
} else if (u.indexOf('Windows Phone') > -1) {//winphone手机
device = "WindowsPhone";
}
}
function Remove(ele){
$(ele).contents().filter(function() {
return this.nodeType === 3;
}).remove();
}
Remove(".pagination")
//去掉inline-block的间距
// var imgs=$("img");
// imgs.on("contextmenu",function(){return false;});
// imgs.on("dragstart",function(){return false;});
// document.body.onselectstart=document.body.oncontextmenu=function(){return false;};
// 图片文字禁止
//
// function _width(){
// if($(document).innerWidth() <= 1023){
// $("div").find("br").hide();
// }
// }
// _width();
// $(window).resize(function(){
// _width();
// });
$(function(){
function visual_button_scroll_down(){
$(".idem").each(function(){
$(this).on('click',function(){
var target = $(this).attr('href');
var target_top = $(target).offset().top-64;
$('html,body').animate({
scrollTop : target_top
},1500, 'easeInOutQuad');
return false;
});
})
}
visual_button_scroll_down();
})
function scrollAnimation(ele) {
$(ele).each(function() {
var _this = $(this);
if (_this.offset().top > $(window).scrollTop() + $(window).height() || _this.offset().top < $(window).scrollTop() - _this.outerHeight()) {
// _this.removeClass('animate');
} else if ($(window).scrollTop() > _this.offset().top - $(window).height() * 0.7) {
//预先加载图片begin
var arrayimg2 = [];
arrayimg2.push(_this.find('img').attr('src'));
_PreLoadImg(arrayimg2,function(){
// 执行函数
_this.addClass('animate');
// _this.find(".k10 .ul").addClass('animate');
_this.find(".loading-sw").remove();
})
//预先加载图片end
}
});
$(window).scroll(function() {
$(ele).each(function() {
var _this = $(this);
if (_this.offset().top > $(window).scrollTop() + $(window).height() || _this.offset().top < $(window).scrollTop() - _this.outerHeight()) {
// _this.removeClass('animate');
} else if ($(window).scrollTop() > _this.offset().top - $(window).height() * 0.7) {
_this.addClass('animate');
// _this.find(".k10 .ul").addClass('animate');
_this.find(".loading-sw").remove();
}
});
});
}
function scrollAnimation2(ele) {
$(ele).each(function() {
var _this = $(this);
if (_this.offset().top > $(window).scrollTop() + $(window).height() || _this.offset().top < $(window).scrollTop() - _this.outerHeight()) {
// _this.removeClass('animate');
} else if ($(window).scrollTop() >= _this.offset().top - $(window).height() * 0.9) {
_this.addClass('animate');
setInterval(function(){
$("body").addClass("avh0");
},50)
// _this.find(".k10 .ul").addClass('animate');
_this.find(".loading-sw").remove();
}
});
$(window).scroll(function(){
$(ele).each(function() {
var _this = $(this);
if (_this.offset().top > $(window).scrollTop() + $(window).height() || _this.offset().top < $(window).scrollTop() - _this.outerHeight()) {
// _this.removeClass('animate');
} else if ($(window).scrollTop() >= _this.offset().top - $(window).height() * 0.9) {
// console.log($(window).scrollTop() ,_this.offset().top - $(window).height() * 0.8)
_this.addClass('animate');
// _this.find(".k10 .ul").addClass('animate');
_this.find(".loading-sw").remove();
}
});
});
}
scrollAnimation2($('.secwen'));
$(window).scroll(function() {
var top = ($(window).scrollTop() / 3);
$(".sy-con-banner").css("background-position-y");
$(".sy-con-banner").css({'background-position-y': top,'background-size':"cover"});
});
setInterval(function(){
$(".cobv").find(".secwen").addClass("animate");
$(".product-top").addClass("animate");
$(".conbanner").find(".secwen").addClass("animate");
},500)