How can I scroll the first visible element with a specific div class?

Do I need to automatically automatically scroll the first visible element with a specific div class using javascript?

thanks!

+8
javascript jquery scroll
source share
1 answer

You should be able to use something like this:

$('html, body').animate({ scrollTop: $('.class:visible:first').offset().top }, 1000); 

Demo: http://jsfiddle.net/Blender/xUw54/2/

+17
source share

All Articles