如何在父项中使用滚动修复。。我想要滚动,但下一个按钮和上一个按钮是固定的移动。。如何使用jquery
项目中的i键当滚动始终居中时,类prevbutton和nextbutton是固定的如何在父项中使用滚动修复。。我想要滚动,但下一个按钮和上一个按钮是固定的移动。。如何使用jquery,jquery,css,Jquery,Css,项目中的i键当滚动始终居中时,类prevbutton和nextbutton是固定的 <div class="container"> <div class="items"> <div class="prevbutton button"> prev </div> <div class="nextbutton button"> next </div> </div> </div>
<div class="container">
<div class="items">
<div class="prevbutton button"> prev </div>
<div class="nextbutton button"> next </div>
</div>
</div>
//jquery
$(window).bind('scroll', function () {
if ($(window).scrollTop() > num) {
$('.button').addClass('fixed');
} else {
$('.button').removeClass('fixed');
}
});
当在itemClass中滚动时,我想要中间的prediv和nextdiv
当滚动。。如何使用jquery
我想要这种风格,它总是中央上下按钮。。。。
如何使用jquery和css
参见jsfiddle
参见示例
$(文档).ready(函数(){
$(窗口)。滚动(函数(){
如果($(this).scrollTop()>200){
$(#scrolltotop').fadeIn(200);
}否则{
$(#scrolltotop')。淡出(200);
}
});
//设置滚动到顶部的动画
$('#scrolltotop')。单击(函数(事件){
event.preventDefault();
$('html,body').animate({scrollTop:0},600);
})
});
有小提琴吗?还有你试过的代码吗?像这样的是的,兄弟。但我想用prevbutton和nextbutton向下滚动和向上滚动。。我想要jquery..此按钮类不是位置:已修复。。但是这个位置:固定在itemshey内!我的朋友们,我想要jquery scrollTop。。请查看照片查看此链接我希望上一个和下一个是滚动的顶部和底部,但它是有限的
$(window).bind('scroll', function () {
if ($(window).scrollTop() > num) {
$('.button').addClass('fixed');
} else {
$('.button').removeClass('fixed');
}
});
add this css it works jquery not needed
.prevbutton,.nextbutton{
top:50%;
cursor:pointer;
position:fixed;
background-color:#FF8000;
font-size:25pt;
border:1px solid red;
width:80px;
text-align:center;
}
.prevbutton{left:0px;}
.nextbutton{right:0px;}
<script>
$(document).ready(function() {
$(window).scroll(function() {
if ($(this).scrollTop() > 200) {
$('#scrolltotop').fadeIn(200);
} else {
$('#scrolltotop').fadeOut(200);
}
});
// Animate the scroll to top
$('#scrolltotop').click(function(event) {
event.preventDefault();
$('html, body').animate({scrollTop: 0}, 600);
})
});
</script>
<a href="javascript:void(0)" id="scrolltotop" style="position:fixed:bottom:0px;right:20px;">scroll top</a>