You will recieve your password to this address. Address is not made public.

Your preferred username that is used when logging in.

Disable one Tab Created Nov 18, 2009

This thread is solved

Views: 1911     Replies: 3     Last reply Nov 23, 2009  
You must login first before you can use this feature

anael.favre

Posts: 1

Registered:
Nov 18, 2009

Disable one Tab

Posted: Nov 18, 2009

Hello,

Primary, thanks for this usefull / beautifull jquery additions :)

So, i tried to disable one tab (note hide) but it doesnt work. I tried with a calback function like this :


$(function() {
	$("ul.tabs").tabs("div.panes > div", {
		effect: 'fade',
		onBeforeClick: function(event, tabIndex) {
			if(this.getCurrentTab().is(".desact")) {
				return false;
			}
		}
	});
});

The tab witch should be desactivated have the desact class like this :


<ul class="tabs">
	<li><a href="#">Foo</a></li>
	<li class="desact"><a href="#">Bar</a></li>
</ul>

I dont know how to do, thanks for your help :)

EDIT : I just want the desactivated tab do nothing when I click on.

Chag

Posts: 4

Registered:
Oct 20, 2009

» Disable one Tab

Posted: Nov 20, 2009

Reply to: Disable one Tab, from anael.favre
Hi,

I'm interrested in this feature too. Your code seems ok. have you tried to do some alert(); juste to be sure the callback function is called and the condition is verified ?

Chag

jetico

Posts: 2

Registered:
Nov 21, 2009

» Disable one Tab

Posted: Nov 21, 2009

Reply to: Disable one Tab, from anael.favre
I think getCurrentTab() returns the current active tab, rather than the tab (pre-) clicked. My solution (I'm a newbie so would appreciate improvements) was:


api.onBeforeClick( function(e, i) {
    if ($("ul.tabs > li").eq(i).hasClass("disabled")) {
		     return false;
    }
});

Chag

Posts: 4

Registered:
Oct 20, 2009

» » Disable one Tab

Posted: Nov 23, 2009

Reply to: » Disable one Tab, from jetico
Hi,

As i couldn't find the good syntax to use your code (where does the 'api' var come from ? I'm sure it's easy but I don't get it :) ), here's mine that is complete :


	var tabs = $("ul.tabs").tabs("div.panes > div", {
		onBeforeClick : function(e, i) { 
		    if ($("ul.tabs > li").eq(i).hasClass("disabled")) { 
		             return false; 
		    }		
		}
	}); 	


thanks anyway for you help.

Chag