【发布时间】:2016-08-27 12:43:27
【问题描述】:
我的主页上有一个下行链接,当用户点击时,它会向下移动页面。一旦用户从顶部滚动 10 个像素但无法使其正常工作,我试图让它改变为返回顶部链接。有谁知道我哪里出错了。另一件不起作用的事情是平滑滚动 jQuery。
头
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script type="text/javascript" src="JQuery/jquery.js"></script>
<script type="text/javascript" src="JQuery/html5lightbox.js"></script>
<script type="text/javascript" src="JQuery/counter.js"></script>
<script type="text/javascript" src="JQuery/smoothscroll.js"></script>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script>
<script type="text/javascript" src="JQuery/script.js"></script>
HTML
<div class="down-link"><a href="#about" id="w-downlink" class="smoothscroll"><i class="ss-navigatedown"></i></a></div>
CSS
.down-link {
width:100%;
height:50px;
}
#w-downlink i {
line-height: 42px;
font-size: 24px;
color: #fff;
display: block;
width: 24px;
margin: 0 auto;
margin-top:10px;
}
#w-downlink {
height: 60px;
width: 60px;
background-color: #191919;
background-color: rgba(20, 20, 20, 0.4);
position:absolute;
bottom:0;
margin-bottom:30px;
right:0;
margin-right:20px;
cursor: pointer;
-webkit-transform: translate3d(0, 0, 0);
opacity: 1;
}
.w-downlink:hover {
height: 60px;
width: 60px;
background-color: #191919;
background-color: rgba(20, 20, 20, 0.4);
position:absolute;
bottom:0;
margin-bottom:30px;
right:0;
margin-right:20px;
cursor: pointer;
-webkit-transform: translate3d(0, 0, 0);
opacity: 0.5;
}
使用的jQuery是平滑滚动插件。
$('.w-downlinkn').click(function() {
$('html, body').animate({ scroll: 250 });
});
提前感谢您的支持。
【问题讨论】:
-
请显示您用于向下滚动的 jQuery,并显示包含以下脚本的头部:jQuery、smoothScroll 和您的自定义 jQuery。
标签: javascript jquery html css scroll