how to scroll on a div? scrollTop and offset.top not working for me.
i have a master div named: myScroll
the css:
- .myScroll {
- overflow: auto;
-
- height: 400px;
- }
and this Scroll have 28 divs (28 rows)
with ajax i fill each row, sometimes 1 div have 3 lines in other cases, 12 lines and so on.. (different number of lineS) (see image attached)
then i want move to a visible area and i try:
$(".myScroll").scrollTop($("divRow_" + idxTar).offset.top);
where:
var idxTar = $(this).data('id');
idxTar = Number of row
here a fiddle:
any advice how to do this job? thanks