Jquery scrollTo not working: object doesn't support this property or method
Hello I have included the jquery-1.5.1.min.js and jquery.scrollTo-min.js scripts into my page. I've 开发者_StackOverflow中文版setup the anchor tags seemingly appropriately, but when I click on one of the anchors I get the error mentioned above. Here's some code I've tried.
<a href="#" onclick="$('#midGrids').scrollTo('#avgSpreadGroupGridHere', 800);">Avg Spread</a>
<a href="#" onclick="$.scrollTo('#avgSpreadGroupGridHere', 800);">Avg Spread</a>
<a href="#" onclick="$(...).scrollTo('#avgSpreadGroupGridHere', 800);">Avg Spread</a>
did you named your target id to: "#midGrids" ?
you have to do something like this:
<a href="#" id="target">Target</a>
<a href="#" onclick="$(...).scrollTo('#target', 800);">Avg Spread</a>
精彩评论