$(function () {
$('#header').load('header.html')
$('#footer').load('footer.html')
$('body').css('opacity', 1)
for (let i = 0; i < $('[data-type="wow"]').length; i++) {
if (!$('[data-type="wow"]').eq(i).hasClass('wow')) {
$('[data-type="wow"]').eq(i).addClass('wow fadeInUp')
}
}
var wowList = 0
var wow = new WOW({
boxClass: 'wow', // 闇€瑕佹墽琛屽姩鐢荤殑鍏冪礌鐨 class
animateClass: 'animated', // animation.css 鍔ㄧ敾鐨 class
offset: 0, // 鍏冪礌鐨勪綅缃湶鍑哄悗璺濈搴曢儴澶氬皯鍍忕礌鎵ц
mobile: true, // 鏄惁鍦ㄧЩ鍔ㄨ澶囦笂鎵ц鍔ㄧ敾
live: true, // 寮傛鍔犺浇鐨勫唴瀹规槸鍚︽湁鏁
callback: function (e) {
if ($(e).attr('data-type') === 'wow') {
wowList += 100
$(e).css('animation-delay', wowList + 'ms')
}
}
})
wow.init()
setTimes()
var timeOuts = null
function setTimes() {
timeOuts = setTimeout(function () {
wowList = 0
}, 150)
}
/*****************************鎵嬫満绔欏鑸垏鎹㈡寜閽?******************************/
$('body').on('click', '.headerSJ .navbar', function (event) {
$(this).toggleClass('active unactive')
})
$('body').on('click', '.headerSJ .navbar.unactive', function (event) {
$('.headerSJ .navwrap').animate({
'top': '60px',
'opacity': '1'
}, 500)
})
$('body').on('click', '.headerSJ .navbar.active', function (event) {
$('.headerSJ .navwrap').animate({
'top': '100%',
'opacity': '0'
}, 500)
})
$('body').on('click', '.headerSJ .plus', function () { //浜岀骇鏍忕洰鎵嬮鐞村垏鎹㈡晥鏋
$(this).toggleClass('minus').parent().siblings().find('.minus').removeClass('minus')
$(this).next('.SJbod').stop().slideToggle(300).parent().siblings().find('.SJbod').stop().slideUp(500)
})
var st = $(window).scrollTop()
$('.countup').each(function (index, el) {
var id = $(el).attr('id') || '_countup' + (new Date().getTime()) + $(el).index('.countup')
$(el).attr('id', id)
el.countOnOff = true
var decimals = $(el).attr('decimals') || 0
el.options = $(el).attr('options') ? JSON.parse($(el).attr('options')) : {
"separator": ""
}
el.num = new CountUp(id, 0, $(el).text(), decimals, 5, el.options)
if (st > $(el).offset().top - $(window).height() + $(el).outerHeight() && el.countOnOff) {
el.num.start()
el.countOnOff = false
}
})
if (!$('.header').hasClass('forceFixed')) {
if (st > 0) {
$('.header').addClass('fixed')
} else {
$('.header').removeClass('fixed')
}
}
$(window).scroll(function () {
/*婊氬姩鏃跺厛娓呴櫎涓婁竴涓畾鏃跺櫒,鐒跺悗鍐嶈缃柊鐨勫畾鏃跺櫒,浠ュ厤鍑虹幇澶氫釜瀹氭椂鍣ㄩ€犳垚娣蜂贡*/
clearTimeout(timeOuts)
setTimes()
st = $(window).scrollTop()
$('.countup').each(function (index, el) {
if (st > $(el).offset().top - $(window).height() + $(el).outerHeight() && el.countOnOff) {
el.num.start()
el.countOnOff = false
}
})
if (!$('.header').hasClass('forceFixed')) {
if (st > 0) {
$('.header').addClass('fixed')
} else {
$('.header').removeClass('fixed')
}
}
})
// 浼樺寲a鏍囩
$('a').each(function () {
if ($(this).attr('href') == '') {
$(this).attr('href', 'javascript:;')
} else if ($(this).attr('href') == undefined) {
$(this).css('cursor', 'pointer')
}
})
$('body').on('click', '.video_btn', function () {
var videoSrc = $(this).attr('data-videoSrc') || ''
var tit = $(this).attr('data-tit') || ''
var subTit = $(this).attr('data-subTit') || ''
$('#video_model video').attr('src', videoSrc)
$('#video_model .text h6').text(tit)
$('#video_model .text p').text(subTit)
if (!tit) $('#video_model .text h6').hide()
if (!subTit) $('#video_model .text p').hide()
$('#video_model').fadeIn()
})
$('body').on('click', '#video_model .mask, #video_model .close', function () {
$('#video_model').fadeOut()
$('#video_model video').attr('src', '')
})
$('body').on('mouseenter', '.header_nav > li', function () {
$(this).children('.header_nav2, .header_nav3').stop().slideDown(200)
$(this).addClass('on').siblings('.active').addClass('unactive').removeClass('active')
})
$('body').on('mouseleave', '.header_nav > li', function () {
$(this).children('.header_nav2').stop().slideUp(200)
$(this).removeClass('on').siblings('.unactive').addClass('active').removeClass('unactive')
})
$('body').on('change', '[name="websit"]', function (e) {
var url = $('[name="websit"]').find('option:selected').val()
$('[name="websit"]').val('')
window.open(url)
})
$('body').on('keydown', '[name="keyword"]', function (e) {
var keyword = $('[name="keyword"]').val()
if (e.keyCode === 13 && keyword) {
window.location.href = 'result.html?keyword=' + keyword
}
})
$('body').on('click', '.header .header_nav li.search .img', function (e) {
var keyword = $('[name="keyword"]').val()
if (keyword) {
window.location.href = 'result.html?keyword=' + keyword
}
})
$('body').on('click', '.header_search_m .img', function () {
var keyword = $('[name="keywordm"]').val()
if (keyword) {
window.location.href = 'result.html?keyword=' + keyword
}
})
var navI = $('body').data('index')
setTimeout(function () {
$('.header_nav > li').eq(navI).addClass('active').siblings().removeClass('active')
}, 200)
})