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.
145 lines
5.3 KiB
145 lines
5.3 KiB
var isMobile = window.screen.width <= 768
|
|
$('.footer .w1280 .bottom .left .link .text').click(function (event) {
|
|
event.stopPropagation()
|
|
if ($(this).hasClass('on')) {
|
|
$(this).siblings('.list').stop().fadeOut()
|
|
$(this).removeClass('on')
|
|
return
|
|
}
|
|
$(this).siblings('.list').stop().fadeIn()
|
|
$(this).addClass('on')
|
|
})
|
|
$('body').click(function () {
|
|
$('.footer .w1280 .bottom .left .link .text').removeClass('on')
|
|
$('.footer .w1280 .bottom .left .link .list').stop().fadeOut()
|
|
$('.footerMob .w1280 .linkFriend .right .text').removeClass('on')
|
|
$('.footerMob .w1280 .linkFriend .right .linkList').stop().fadeOut()
|
|
$('.header > .right .search').removeClass('on')
|
|
$('.header > .right .headSearch').stop().fadeOut()
|
|
})
|
|
// pc导航 hover 下拉
|
|
$('.header .right .nav li').hover(function(){
|
|
let downListHei = $(this).children('div').children('.w1280').outerHeight(true)
|
|
// let downListHei2 = $(this).children('level2').children('.w1200').outerHeight(true)
|
|
$(this).children('.level').stop().animate({'height':downListHei})
|
|
$(this).children('.level2').stop().animate({'height':downListHei})
|
|
},function(){
|
|
$(this).children('.level').stop().animate({'height':'0'})
|
|
$(this).children('.level2').stop().animate({'height':'0'})
|
|
})
|
|
// 移动端导航按钮,显示导航
|
|
$('.headerMob .fixed .w1280 .menu').click(function(){
|
|
if($(this).hasClass('on')){
|
|
$('.headerMobList').stop().fadeOut()
|
|
$(this).removeClass('on')
|
|
return
|
|
}
|
|
$(this).addClass('on')
|
|
$('.headerMobList').stop().fadeIn()
|
|
})
|
|
// 二级下拉点击,关闭同时关闭三级下拉
|
|
$('.headerMobList ul li > a > span').click(function(event){
|
|
event.preventDefault()
|
|
let navListHeight = $(this).parent().siblings().children('.list').length * $(this).parent().siblings().children('.list').outerHeight(true)
|
|
if($(this).parent().hasClass('on')){
|
|
$(this).parent().removeClass('on')
|
|
$(this).parent().siblings().stop().animate({'height':0})
|
|
$(this).parent().siblings().children().children('a').removeClass('on')
|
|
$(this).parent().siblings().children().children('.level2').animate({'height':0})
|
|
return
|
|
}
|
|
$(this).parent().addClass('on')
|
|
$(this).parent().siblings().stop().animate({'height':navListHeight})
|
|
})
|
|
// 三级下拉点击
|
|
$('.headerMobList ul li .level .list > a span').click(function(event){
|
|
event.preventDefault()
|
|
let navListHeight2 = $(this).parent().siblings().children('').length * $(this).parent().siblings().children('').outerHeight(true)
|
|
if($(this).parent().hasClass('on')){
|
|
$(this).parent().removeClass('on')
|
|
$(this).parent().siblings().stop().animate({'height':0})
|
|
$(this).parents('.level').stop().animate({'height': $(this).parents('.level').height() - navListHeight2})
|
|
return
|
|
}
|
|
$(this).parent().addClass('on')
|
|
$(this).parent().siblings().stop().animate({'height':navListHeight2})
|
|
$(this).parents('.level').stop().animate({'height': $(this).parents('.level').height() + navListHeight2})
|
|
})
|
|
// 友情链接-移动
|
|
$('.footerMob .w1280 .linkFriend .right .text').click(function(event){
|
|
event.stopPropagation()
|
|
if($(this).hasClass('on')){
|
|
$(this).siblings().stop().fadeOut()
|
|
$(this).removeClass('on')
|
|
return
|
|
}
|
|
$(this).siblings().stop().fadeIn()
|
|
$(this).addClass('on')
|
|
})
|
|
// 右侧浮框
|
|
let pageHeight = $(window).height()
|
|
$('.rightBlock').css('display','none')
|
|
$(window).resize(function(){
|
|
let pageHeight = $(window).height()
|
|
})
|
|
$(document).ready(function(){
|
|
if($(window).scrollTop() > pageHeight/2){
|
|
$('.rightBlock').stop().fadeIn()
|
|
}else{
|
|
$('.rightBlock').stop().fadeOut()
|
|
}
|
|
})
|
|
$(window).scroll(function(){
|
|
if($(window).scrollTop() > pageHeight/2){
|
|
$('.rightBlock').stop().fadeIn()
|
|
}else{
|
|
$('.rightBlock').stop().fadeOut()
|
|
}
|
|
})
|
|
$('.rightBlock .list').hover(function(){
|
|
$(this).children('.position').stop().fadeIn()
|
|
},function(){
|
|
$(this).children('.position').stop().fadeOut()
|
|
})
|
|
$('.rightBlock .toTop').click(function(){
|
|
$('body,html').stop().animate({scrollTop:0})
|
|
})
|
|
// 搜索
|
|
$('.header .w1280 > .right .search').click(function(event){
|
|
event.stopPropagation()
|
|
if($(this).hasClass('on')){
|
|
$(this).removeClass('on')
|
|
$('.header .w1280 > .right .headSearch').stop().fadeOut()
|
|
return
|
|
}
|
|
$(this).addClass('on')
|
|
$('.header .w1280 > .right .headSearch').css('right',$('.header .w1280').offset().left)
|
|
$('.header .w1280 > .right .headSearch').stop().fadeIn()
|
|
})
|
|
$('.header .w1280 > .right .headSearch input').click(function(event){
|
|
event.stopPropagation()
|
|
})
|
|
$(".header .w1280 > .right .headSearch input").keypress(function(e){
|
|
if(e.which == 13){ // 回车键的键值是13
|
|
window.location.href = '/search?q=' + $(".header .w1280 > .right .headSearch input").val()
|
|
}
|
|
});
|
|
$('.headSearchBtn').click(function(){
|
|
window.location.href = '/search?q=' + $(".header .w1280 > .right .headSearch input").val()
|
|
})
|
|
// 移动搜索
|
|
$('.searchBtnMob').click(function(){
|
|
if( $('.headerMobList .search input').val() == ''){
|
|
alert('请输入搜索内容');
|
|
return
|
|
}
|
|
window.location.href = '/search?q=' + $(this).siblings('input').val()
|
|
})
|
|
// 页面进入,子导航自动跳转到选中
|
|
let pageListNav = $('.pageListNav').html()
|
|
if(pageListNav){
|
|
let pageListNavOffset = $('.pageListNav .w1280 a.on').offset().left
|
|
$('.pageListNav .w1280').scrollLeft(pageListNavOffset - $('.pageListNav .w1280').offset().left)
|
|
}else{
|
|
pageListNav = 0
|
|
}
|