jQuery滚动条需要在到达末尾后停止滚动

7
我在我的一个网站中使用滚动条。 当我单击向下箭头以将滚动条滚动到底部时,时间显示为 10:00 PM。如果我再次单击向下箭头,则滚动条会再次上移并且整个内容都消失了。 如果达到结束时间[这里是10:00 PM],我希望停止向下箭头的工作。
在单击向上箭头时也会出现相同的问题。我们试图解决此问题,但没有成功。
Jsfiddle链接:http://jsfiddle.net/Xh59R/3/ 附带图片。
谢谢。
2个回答

2
请查看以下的jsfiddle链接:http://jsfiddle.net/Xh59R/8/ 点击下一个按钮...
$scrollerNextButton.click(function(e){

//PUT THESE AT END
var divMargnTop=parseInt(document.getElementById("DemoShowHide").style.top);
var divMaxTopAllowed=parseInt(-1600);
if(divMargnTop<=divMaxTopAllowed)
{
$scrollerNextButton.stop().hide("fast");
}
});

对于“上一页”按钮的点击...

var divMinMargnTop=parseInt(document.getElementById("DemoShowHide").style.top);
var divMinMaxTopAllowed=parseInt(0);
if(divMinMargnTop>=divMinMaxTopAllowed)
{
    $scrollerPrevButton.stop().hide("fast");
}

http://jsfiddle.net/Xh59R/8/


1
我认为你可以使用类似这样的东西:

$scrollerNextButton.click(function (e) {
    var lines = $("div[style*='width:100%']");
    var total = lines.outerHeight(true) * lines.length;
    if ($scroller.position().top > total) {
        $scrollerNextButton.stop().hide("fast");
    }
});

我在jsfiddle中尝试了你的代码,但它没有工作。你能否在jsfiddle中编辑它。http://jsfiddle.net/Xh59R/5/ 谢谢 - syam deth

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接