I've searched the web at length for a solution and come very close, but I'm hoping someone smarter than I can perfect this. When I click a div, I would like the top of said div to scroll to the top of the browser window. The current code snippet causes a parent div with the id "centered" to scroll to the top, but I would like each child div to scroll to its own top without having to write out an instance for every single div.
toggle:function(divid){ //public method
if (typeof divid=="object")
divid=divid[0]
this.showhide(divid, "toggle")
$("html, body").animate({scrollTop:$('#centered').position().top}, 600);
}
Can anyone point out what I'm missing?