开发者

Keeping tabs with "a href=#sometabname" from scrolling to the anchor with jQuery

开发者 https://www.devze.com 2023-01-16 11:21 出处:网络
I have a set of vertic开发者_开发知识库al tabs about a quarter of the way down my page. They are all visible on page load from the top of the browser window. When you click on a tab, it scrolls down a

I have a set of vertic开发者_开发知识库al tabs about a quarter of the way down my page. They are all visible on page load from the top of the browser window. When you click on a tab, it scrolls down and puts the tab content at the top of the window. I know why it does this, is there anyway to override this behavior so that the tabs change content but the window does not scroll? Thanks, Kane


return false or use preventDefault();

Here's an example for you: http://jsfiddle.net/tUaqw/


Figured it out was a issue with the UI, can't give the anchor and the tab itself the same ID. Thanks for your help, yours is the way it should work!

0

精彩评论

暂无评论...
验证码 换一张
取 消