My site is running jQuery 1.6.2. This I cannot change.
I am trying to check if a #hash is present in the url and load a jQuery tabs to a specific tab, like so...
if(window.location.hash == '#rates') {
$("#tabs").tabs({
show: { effect: "slideDown", duration: 300 },
hide: { effect: "fade", duration: 300 },
active: 4
)};
} else {
$("#tabs").tabs({
show: { effect: "slideDown", duration: 300 },
hide: { effect: "fade", duration: 300 }
});
}
It's not working and just breaks jQuery tabs. If i remove all the if / else and just have the following...
$("#tabs").tabs({
show: { effect: "slideDown", duration: 300 },
hide: { effect: "fade", duration: 300 },
active: 4
});
it works as expected. Does anyone know what could be causing this issue? I'm wondering if it's just jQuery version that doesn't like how I wrote it... I know similar stuff works fine on other site's I've worked on.
You've messed up the closing parenthesis in the if
part
if(window.location.hash == '#rates') {
$("#tabs").tabs({
show: { effect: "slideDown", duration: 300 },
hide: { effect: "fade", duration: 300 },
active: 4
}); // was )};
} else {
$("#tabs").tabs({
show: { effect: "slideDown", duration: 300 },
hide: { effect: "fade", duration: 300 }
});
}