Jquery Show & ScrollTop (or ScrollTo)
Just as the topic says I'm trying to get a link to open a hidden div then scroll to it. I have the first part taken care of. As for the scrollTop or ScrollTo function I've been trying to use the ScrollTo plugin and for an unknown reason it's not working.
First of all does this look correct?
<li>
<a href="#" rel="toggle[kov]" title="$.scrollTo('开发者_JS百科div#kov', 500);">
Sara Kovanda
</a>
Then later down the page
<section class="container" id="kov">
I'm using the dynamic drive script, http://www.dynamicdrive.com/dynamicindex17/animatedcollapse.htm For the first part since after hours of looking I cannot find a jquery plugin that allows for multiple divs that show on click and hides any current div that's open.
Any help would be extremely helpful here.
Simple example, no plugins:
http://jsfiddle.net/wr2sj/2/
$("#a").click(function() {
$('html, body').animate({
scrollTop: $("#b").offset().top
});
return false;
});
精彩评论