开发者

How to Hide the up or down arrow key when scrolling at the end of the Jscrollpane

开发者 https://www.devze.com 2023-04-08 21:22 出处:网络
I used the JScrollPane from http://jscrollpane.kelvinluck.com/ and modified it to hide the arrow key when scrolling at the end (top or bottom). When scrollbar is at the top, the arrowUp should disappe

I used the JScrollPane from http://jscrollpane.kelvinluck.com/ and modified it to hide the arrow key when scrolling at the end (top or bottom). When scrollbar is at the top, the arrowUp should disappear, showing only arrowDown at the bottom and appears again when scrolling down.

I've made the arrow image disappear at the top, but the problem is the scroll track does not change but just adds extra space equal to the size of the arrow image at the very bottom. How can I go around this, how do I change it so that when the arrow is hidden at one end, the jspTrack's height is adjusted as well, showing the other arrow on the opposite end without extra space?

if (settings.showArrows) {开发者_C百科

                if(isAtTop){
                    arrowUp.addClass('jspDisabled');
                    arrowUp.css('display', 'none');
                }
                else{
                    arrowUp.removeClass('jspDisabled');
                    arrowUp.css('display', 'block');
                }

                if(isAtBottom){
                    arrowDown.addClass('jspDisabled');
                    arrowDown.css('display', 'none');
                }
                else{
                    arrowUp.removeClass('jspDisabled');
                    arrowDown.css('display', 'block');
                }

                /*arrowUp[isAtTop ? 'addClass' : 'removeClass']('jspDisabled');
                arrowDown[isAtBottom ? 'addClass' : 'removeClass']('jspDisabled');*/



            }

Thanks all.


you can control it via css

<style>
.jspVerticalBar{
  background:none;
}
.jspVerticalBar .jspArrow{
  display:block;
}
.jspVerticalBar .jspDisabled
{
  display:none;
}
</style>

JavaScript:

<script>
 $('.pane').jScrollPane({showArrows:true});
</script>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号