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

  $ ('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'});});    

Instead of using margins, why do you use scrollTop

The browser will note that the values ​​should be less than 0 or less than the upper bound.

  $ ('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

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -