//鼠标移上效果
$(".carousel-item").hover(
function () {
$(".carousel-item>section").addClass("hero-area-before");
$(".carousel-item>section>div").css("display", "");
},
function () {
$(".carousel-item>section").removeClass("hero-area-before");
$(".carousel-item>section>div").css("display", "none");
}
);
//跳到锚点:品质保障
function Goto() {
var pz = document.querySelector("#about1");
pz.scrollIntoView({
block: 'start',
inline: 'nearest',
behavior: 'smooth'
});
}
//跳到锚点:生产工艺
function GotoGY() {
var pzgy = document.querySelector("#about2");
pzgy.scrollIntoView({
block: 'start',
inline: 'nearest',
behavior: 'smooth'
});
}
//返回顶部
function GotoHeader(minHeight){
$('html,body').animate(
{
scrollTop:'0px'
},
'slow'
);
minHeight? minHeight=minHeight : minHeight=600;
$(window).scroll(function(){
var s = $(window).scrollTop();
if( s > minHeight){
$("#gotoTop").fadeIn(500);
}else{
$("#gotoTop").fadeOut(500);
}
})
}
//拖动滚动条或滚动鼠标轮
window.onscroll=function(){
if(document.body.scrollTop||document.documentElement.scrollTop){
document.getElementById('rTop').style.display="block"
}else{
document.getElementById('rTop').style.display="none"
//button1style.cursor="hand"
}
}
记录返回顶点JS代码
最新推荐文章于 2024-06-10 21:57:03 发布