A.Sharma
A.Sharma

Reputation: 2799

Prevent jQuery Tab from Performing Transitioning Effect on Active Tab

I'm using jQuery tabs, and I currently have a slide effect whenever you click on a tab. My question is: How do you prevent a slide effect from happening on the current active tab if you click it again.

Here is my jQUery:

$(document).ready(function(){
 $('#tabs').tabs();
 $("#tabs a").click(function() {
    $('#tabs p').effect( "slide", "medium" );
 });
});

Here is the fiddle:

http://jsfiddle.net/YRp62/2/

If you click "Second" and then click "Second" again. It slides into itself. How do you break the effect if you click on the active tab?

Upvotes: 2

Views: 68

Answers (1)

Umesh Sehta
Umesh Sehta

Reputation: 10683

use tabs activate event instread of click event

$(document).ready(function(){
$('#tabs').tabs({
 activate: function(event, ui){
     $('#tabs p').effect( "slide", "medium" );
    }
  });   
});

Demo

Upvotes: 4

Related Questions