我正在尝试实现以下查找可以上下滚动的框:
而不是侧面的滚动条。这是否可能是当他们单击向上箭头或将鼠标悬停在其上时,它向上滚动并且向下箭头相同?以及他们是否使用滚动按钮?
最佳答案
这只是一个简单的例子,希望对你有所帮助。 Fiddle
您唯一需要的 jQuery 代码是:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#prev').click(function(){
$('li:last').detach().prependTo('ul').css({'margin-top':'-=100px'})
$('li:first').stop().animate({'margin-top':'0px'},1000)
})
$('#next').click(function(){
$('li:first').stop().animate({'margin-top':'-=100px'},1000,function(){
$(this).detach().css({'margin-top':'0px'}).appendTo('ul')
})
})
})
</script>
如果您想构建纯 css 箭头,请访问此站点:link
你的结果将是fiddle
有时候简单就是最好的事情..by
关于javascript - 使用按钮自定义滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23040892/