I have a div with a lot of elements inside it and overflow: scroll. Then I want to be able to scroll the nth element in the field of view. I gave him a violin, but I can’t find an expression to get the position of the element relative to the parent.
http://jsfiddle.net/bortao/NXcTK/
I tried both el.position().top, and el.offset().top, but they do not work.
Note: h / 2- this means that the element is located in the middle of the div.
ariel source
share