javascript - Determining downward and upward scrolling -
i have sapui5 table , trying log in console if table being scrolled or down. can working if use regular div.
example here.
but can't seem work sapui5 table. have tried following:
var lastscroll = 0; $("#__xmlview0--players-vsb-sb").scroll(function () {     var st = $(this).scrolltop();     if (st > lastscroll) {         console.log("scrolling down");     } else {        console.log("scrolling up");     }     lastscroll = st; }); i'm getting id #__xmlview0--players-vsb-sb when inspect element on scrollbar. seems id should use. ideas of how work?
here jsbin.
if put scroll event inside settimout, starts working.
        settimeout(function(){             var lastscroll = 0;         $("#__xmlview0--players-vsb-sb").scroll(function () {                 var st = $(this).scrolltop();                 if (st > lastscroll) {                     console.log("scrolling down");                 } else {                     console.log("scrolling up");                 }                 lastscroll = st;             }); }, 700); this indication ui library clearing out events on elements uses when initializes own events on them. remove risk of memory leaks. suggest not using timeout, , seeing stack more info: sapui5-which method call once view displayed everytime?
Comments
Post a Comment