javascript - Detect element is at the top of its parent - jQuery -
I am doing trinx to create a simple content scroller.
On my UTONE click I have a div up and down 15 pixels of my parents, even if its id on top, to disable this function, what is the best way to do this?
JSFIDDLE jQUERY Instead of using margins, why do you use The browser will note that the values should be less than 0 or less than the upper bound.
$ ('Up'). Click (function (e) {e.preventDefault (); $ (this) .Parent (). ('Internal-scrolling'). CSS ({marginopt: '- = 15px'});} ); $ ('Down'). Click (function (e) {e.preventDefault (); $ (this). Parent (). ('Internal-scroll'). Css ({marginTop: '+ = 15px'});});
scrollTop
$ ('up') (function (e) {e.preventDefault (); var s = $ (this). Parent (). Prev (); s.scrollTop ( S.scrollTop () - 15);}); Click $ ('down') (function (e) {e.preventDefault (); var s = $ (this) parent (). Prev (); s.scrollTop (s.scrollTop () + 15);} );
Comments
Post a Comment