睿能科技
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

132 lines
4.7 KiB

// 导航距离左侧调整
let navLeftArea = $('.header .location').offset().left
$('.header .nav').css('margin-left', navLeftArea)
// 导航下拉位置
$('.header .nav ul li > .level').css({
'margin-left': -navLeftArea,
'width':$(window).width(),
})
// 技术支持完善客服
$('.jishuBlock3 .content .left').css('padding-left',navLeftArea)
$(window).resize(function () {
// 导航距离左侧调整
let navLeftArea = $('.header .location').offset().left
$('.header .nav').css('margin-left', navLeftArea)
// 导航下拉位置
$('.header .nav ul li > .level').css('margin-left', -navLeftArea)
$('.header .nav ul li > .level').css('width',$(window).width())
// 技术支持完善客服
$('.jishuBlock3 .content .left').css('padding-left',navLeftArea)
})
// footer hover
$('.footer .w1400 .top .left ul li').hover(function () {
$(this).children('.position').stop().fadeIn()
}, function () {
$(this).children('.position').stop().fadeOut()
})
$('.footer .w1400 .top .left ul li').hover(function () {
$(this).children('.position').stop().fadeIn()
}, function () {
$(this).children('.position').stop().fadeOut()
})
$('.footer .w1400 .top .right ul li').hover(function () {
$(this).children('.position').stop().fadeIn()
}, function () {
$(this).children('.position').stop().fadeOut()
})
// aos.js
AOS.init({
easing: 'ease-out-back',
duration: 1000
});
// 滚动修改导航栏
$(window).scroll(function () {
if ($(window).scrollTop() > 1) {
$('.header').addClass('active')
return
}
$('.header').removeClass('active')
})
// 下拉导航
$('.header .nav ul li').hover(function(){
if($(this).children('.level').children('a').length < 1){
return
}
// $(this).addClass('on')
$(this).children('.level').stop().animate({'height':'80px'})
$('.header .menu .search .searchDiv').stop().animate({'height':'0'})
$('.header .menu .search .searchDiv input').val('')
},function(){
// $(this).removeClass('on')
$(this).children('.level').stop().animate({'height':'0'})
})
// 搜索
$('.header .menu .search').click(function(){
$(this).children('.searchDiv').stop().animate({'height':'80px'})
})
$('.header .menu .search .searchDiv .close').click(function(event){
event.stopPropagation()
$('.header .menu .search .searchDiv').stop().animate({'height':'0'})
})
// 移动端导航
$('.headerMobList ul li').each(function(){
if($(this).children('.level').children('a').length < 1){
$(this).children('a').children('em').css('display','none')
}
})
$('.headerMobList ul li a em').click(function(event){
event.preventDefault()
})
$('.headerMob .w1400 .right .menu').click(function(){
$('.headerMobList').stop().fadeIn()
$('.headerMobList ul').stop().animate({'right':0})
$('.headerMobList .close').stop().animate({'right':'20px'})
})
$('.headerMobList').click(function(){
$('.headerMobList').stop().fadeOut()
$('.headerMobList ul').stop().animate({'right':'-80%'})
$('.headerMobList .close').stop().animate({'right':'-50px'})
$('.headerMobList ul li').removeClass('on')
$('.headerMobList ul li .level').stop().animate({'height': 0})
})
$('.headerMobList ul span .close').click(function(){
$('.headerMobList').stop().fadeOut()
$('.headerMobList ul').stop().animate({'right':'-80%'})
$('.headerMobList .close').stop().animate({'right':'-50px'})
$('.headerMobList ul li').removeClass('on')
$('.headerMobList ul li .level').stop().animate({'height': 0})
})
$('.headerMobList ul').click(function(event){
event.stopPropagation()
})
$('.headerMobList ul li > a').each(function(){
if($(this).siblings('.level').children('a').length > 0){
$(this).removeAttr('href')
}
})
$('.headerMobList ul li > a').click(function(){
let thisLevelNum = $(this).siblings().children('a').length
let thisLevelHeigth = $(this).siblings().children('a').outerHeight(true)
if($(this).parent().hasClass('on')){
$(this).siblings().stop().animate({'height': 0})
$(this).parent().removeClass('on')
return
}
$(this).siblings().stop().animate({'height':thisLevelHeigth * thisLevelNum})
$(this).parent().addClass('on')
})
$('.header .nav ul li a').each(function(){
if(window.location.pathname == $(this).attr('href')){
$(this).parents('li').addClass('on')
}else if(window.location.pathname == $(this).attr('href') + '.html'){
$(this).parents('li').addClass('on')
}
})
$('.rightBlock ul .toTop').click(function(){
$('body,html').stop().animate({scrollTop:0})
})
// 搜索
$('.header .menu .search .searchDiv > div .btn').click(function(){
window.location.href="/search?q=" + $(this).siblings('#search').val()
})