I have a set of vertical 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
views:
21answers:
2
+1
A:
return false or use preventDefault();
Here's an example for you: http://jsfiddle.net/tUaqw/
Robert
2010-09-13 13:52:24
Im using jQuery Tools tabs, I need a way to add bookmarkable links for the tabs and am already using their overlay functionality and don't want to load 2 different UI scripts... so I have this$(function() { $('html').addClass('js'); $("#flowtabs").tabs("#flowpanes > div").history(); $("#flowtabs ul li a").bind('click',function(e){ e.preventDefault(); }); }); and it's still scrolling...
Dirty Bird Design
2010-09-13 14:07:16
I believe your problem is in `$("#flowtabs").tabs("#flowpanes > div").history()` as the click function isn't called with that line uncommented, but is called when I comment that line out. I'm not familiar wit the tabs plugin, but that's where your problem is. http://jsfiddle.net/G5FWn/
Robert
2010-09-13 14:23:22
A:
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!
Dirty Bird Design
2010-09-13 14:11:25