mrsarac
mrsarac

Reputation: 15

jQuery idTabs plugin link options

I am using jQuery idTabs plugin. I want to give click link (href) feature and using default options with this feature. How can I do?

<ul class="idTabs"> 
 <li>
      <a href="#div_1" href="google.com">
      Hover call div_1 and Click Call go to google
      </a>
 </li> 
</ul>

Note: I am using hover feature > $("...").idTabs("!mouseover"); and I used this menu system.

Best Regards.

Upvotes: 0

Views: 1659

Answers (1)

Jose Basilio
Jose Basilio

Reputation: 51488

Here's a way to work around this plugin's limitation so that when you hover you see the contents of the DIV and when you click you navigate to the URL.

In the html add a custom attribute named "url" as follows:

<ul class="idTabs"> 
 <li>
      <a href="#div_1" url="http://www.google.com">
        Hover call div_1 and Click Call go to google
      </a>
 </li> 
</ul>
<div id="div_1">Contents of Div1</div>

In your jQuery script add the following:

$(function(){
 $(".idTabs").idTabs("!mouseover");
 $(".idTabs a").click(function(){
   var url = $(this).attr('url');
   if(url){
     window.location = url;
   }
 });
});

Upvotes: 2

Related Questions