I tried to get the div in the view, and div elements are added dynamically .. so I assign a link from which to click the div element can be introduced into the view, regardless of what it means. so when I click on the link, if the div im trying to jump to the view is already in view, it will disappear from my view. this is mistake?
http://jsfiddle.net/xFu3M/6/
Ive added a working example.
the code looks like
$(".testClick").on("click",function(e){ e.preventDefault(); // Call the scroll function goToByScroll("indID"+1); }); function goToByScroll(id){ // Reove "link" from the ID id = id.replace("link", ""); // Scroll $('.contentBody').animate({ scrollTop: $("#"+id).offset().top}, 'slow'); }
source share