jquery - Detecting scroll to bottom - disable up/down scrolling buttons with return -
i have content div lot of stuff in - headers, paragraphs, tables, images, etc - scrollable through up , down buttons.
the buttons have mousenter, mouseleave, mousedown , mouseup events. want mousevents disabled - return - when reach respective up/down limits. did (down button):
$('.compositos_infobtndown').on('mouseenter', function(){ if ($('.compositos_infocontent').scrolltop() + $('.compositos_infocontent').height() == $('.compositos_infocontent').height()){ return; } // mousenter animation }); $('.compositos_infobtndown').on('mouseleave', function(){ // mousleave animation }); $('.compositos_infobtndown').on('mousedown', function(){ if ($('.compositos_infocontent').scrolltop() + $('.compositos_infocontent').height() == $('.compositos_infocontent').height()){ return; } // mousdown animation // scroll code (working fine) }); $('.compositos_infobtndown').on('mouseup', function(){ if ($('.compositos_infocontent').scrolltop() + $('.compositos_infocontent').height() == $('.compositos_infocontent').height()){ return; } // mousdown animation // scroll code (working fine) });
the html structure:
<div class="compositos_infocontainer"> <div class="compositos_infocontent"> <h3>...</h3> <p>...</p> <div>...</div> <table>...</table> </div> </div>
(the scrolltop being used on scroll code (working fine), of course.) got button working great:
if ($('.compositos_infocontent').scrolltop() === 0){ return; }
... problem down button.
the if statement doesn't work, of course. how can fix this?
thanx in advance.
pedro
just found how it:
if ($('.compositos_infocontent').scrolltop() + $('.compositos_infocontent').innerheight() >= $('.compositos_infocontent')[0].scrollheight){ return; }
hope helps anyone.
pedro
Comments
Post a Comment