[urlParam plugin] (if) Else function doesn't work?
Hi guys,
This is my first post, so if I did anything wrong, tell me.
I have the following code:
- $(document).ready(function(){
- $.urlParam = function(name){ //Get Parameter from URL
- var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
- return results[1] || 0;
- }
- var TabContent = $('#SubNav > div.TabContent');
- TabContent.hide();
- var SelectSub = "";
-
- if($.urlParam('Sub')){
- SelectSub = '.' + $.urlParam('Sub');
- alert(SelectSub);
- }else{
- SelectSub = ":first";
- alert(SelectSub);
- }
-
- $('#SubNav ul.TabNavigation li a').click(function(){
- $.address.value($(this).attr('href').replace(/^#/, ''));
- TabContent.hide().filter('#'+$.urlParam('Sub')).fadeIn(500);
-
- $('#SubNav ul.TabNavigation li a').removeClass("active");
- $(this).addClass("active");
-
- return false;
-
- }).filter(SelectSub).click();
- });
For some reason the Else function (line 16 doesn't work)
What does the script?
JDwebdesign.nl
When you open the link, you see that the portfolio page opens, but the first tab doesn't 'open'.
When you go to this link:
JDwebdesign | with Sub
you see that the 'Projecten' will open, when you change the 'Sub' parameter to 'Lay-Outs' or something, thatone will open first.
But now, when I go to the first link (just the portfolio page) I want it to open the ':first'... why doesn't this work?
All the other coding (if you want to see it, it's in the source)
I hope that some great jQuery hero can help me out :D
Kind regards,
Jelmer