I have adapted a jQuery tabbed interface tutorial to create an interface for viewing some images. The active tab should have an opacity of 1, but with the code I am using the 'current' class is assigned to the 'a' of the tab when clicked, but the opacity does not change, and remains at .3.
I am hoping I can achieve this effect without using the css opacity settings so that it will work with browsers that don't support this. I am very new to Jquery any help would be much appreciated.
// Initialize.
function init_tabs() {
// Does element exist?
if (!$('ul.tabs').length) {
// If not, exit.
return;
}
// Reveal initial content area(s).
$('div.tab_content_wrap').each(function() {
$(this).find('div.tab_content:first').show();
});
$('ul.tabs a').css({ opacity: .3 });
$('ul.tabs a.current').css({ opacity: 1 });
$('ul.tabs a:not(.current)').hover(
function () {
$(this).fadeTo("fast", 1);
},
function () {
$(this).fadeTo("fast", .3);
}
);
// Listen for click on tabs.
$('ul.tabs a').click(function() {
// If not current tab.
if (!$(this).hasClass('current')) {
// Change the current indicator.
$(this).addClass('current').css({opacity: 1}).parent('li').siblings('li')
.find('a.current').removeClass('current').css({opacity: .3}),
// Show target, hide others.
$($(this).attr('href')).fadeIn(300).siblings('div.tab_content').hide();
}
// Nofollow.
this.blur();
return false;
});
}
// Kick things off.
$(document).ready(function() {
init_tabs();
});