简体   繁体   中英

jQuery Tabs - how to remove focus from them after clicking on a tab?

I am using JQuery tabs, but when I select some and then press up/down button, cursor keeps scrolling through tabs instead of scrolling down the page. Anybody got an idea how to fix it? I know I should somehow bind "activate" event to the Tabs and remove focus every time, but I am not sure how to do it. Found also examples of activate binding, but none of them works.

My Tabs:

<div id="tabs"> <ul> <li>
<a href="#tabs-1" >General info</a></li> 
<li><a href="#tabs-2" >Sights</a></li> 
<li><a href="#tabs-3" >Treks and walks</a>
</li> </ul> 
<div id="tabs-1">

etc etc....

Thanks a lot, Jozef

If you wanna add focus or active class to only that tab you click on then I prefer you use 'jQuery' - $this , to make it happend and in that way active or focus will only apply to the tab you click on.

Example:

$('li a').click(function(){

   $(this).addClass('active');

});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM