60 lines
3.1 KiB
JavaScript
60 lines
3.1 KiB
JavaScript
$(function(){
|
||
$('.logo').on('click',function(){//logo图标点击事件
|
||
location.href = 'index.html'
|
||
})
|
||
$('.dao-box li div').mouseover(function(){//导航悬浮事件
|
||
$(this).css("cursor","pointer")
|
||
})
|
||
$('.dao-box li div').click(function(){//导航点击事件
|
||
$('.dao-box li div').removeClass('cq-dao-active')
|
||
$('.dao-box li div div').addClass("dn");
|
||
$('.dao-box li span').addClass("dn");
|
||
$(this).find(".xiahx").removeClass('dn')
|
||
$(this).next(".redD").removeClass('dn')
|
||
$(this).addClass('cq-dao-active')
|
||
})
|
||
var html = '';
|
||
var data = [
|
||
{imgSrc:'img/public/xin-one.png',title:'助力熊猫艺术公益:中国邮政发布著名画家刘中《牛气冲...',time:'2021.06.30',content:'爱彼秉承品牌在形式与功能方面的大无畏创新精神,在腕表发展史上扮演着先行者的角色爱彼秉承品牌在形式与功能方面的大无畏创新精神,在碗表发展史上扮演...'},
|
||
{imgSrc:'img/public/xin-two.png',title:'助力熊猫艺术公益:中国邮政发布著名画家刘中《牛气冲...',time:'2021.06.30',content:'爱彼秉承品牌在形式与功能方面的大无畏创新精神,在腕表发展史上扮演着先行者的角色爱彼秉承品牌在形式与功能方面的大无畏创新精神,在碗表发展史上扮演...'},
|
||
{imgSrc:'img/public/xin-three.png',title:'助力熊猫艺术公益:中国邮政发布著名画家刘中《牛气冲...',time:'2021.06.30',content:'爱彼秉承品牌在形式与功能方面的大无畏创新精神,在腕表发展史上扮演着先行者的角色爱彼秉承品牌在形式与功能方面的大无畏创新精神,在碗表发展史上扮演...'},
|
||
{imgSrc:'img/public/xin-four.png',title:'助力熊猫艺术公益:中国邮政发布著名画家刘中《牛气冲...',time:'2021.06.30',content:'爱彼秉承品牌在形式与功能方面的大无畏创新精神,在腕表发展史上扮演着先行者的角色爱彼秉承品牌在形式与功能方面的大无畏创新精神,在碗表发展史上扮演...'},
|
||
]
|
||
$.each(data, function(commentIndex, comment) {
|
||
html +=`<div class="dac backf p-sx20 w48 m-x32">
|
||
<img src="${comment.imgSrc}" class="xx-img">
|
||
<div class="m-zy15">
|
||
<div class="clips1 font-18 col19">${comment.title}</div>
|
||
<div class="font-12 col9 m-sx10">${comment.time}</div>
|
||
<div class="clips2 font-12 xx-content">${comment.content}</div>
|
||
</div>
|
||
</div>`
|
||
});
|
||
$('.msg').prepend(html);
|
||
let childer = document.querySelectorAll('.ysj .ya-item-box').length
|
||
if(childer==5) {
|
||
$('.ysj').css({"justify-content":"space-between","marginRight":0})
|
||
$('.ysj .ya-item-box').css({"marginRight":0})
|
||
}
|
||
|
||
|
||
|
||
|
||
// 监听页面滚动条变化
|
||
$(window).scroll(function(){
|
||
// 获取滚动条距离顶部的距离
|
||
let s = $(window).scrollTop();
|
||
if(s > 1000){
|
||
$('#gotoTop').fadeIn(100);
|
||
} else {
|
||
$('#gotoTop').fadeOut(200);
|
||
}
|
||
})
|
||
})
|
||
// 回到顶部
|
||
function pageScroll(){
|
||
window.scrollBy(0,-100);
|
||
scrolldelay = setTimeout('pageScroll()',0);
|
||
var sTop = document.documentElement.scrollTop+document.body.scrollTop;
|
||
if(sTop==0) clearTimeout(scrolldelay);
|
||
} |