PDA

View Full Version : Resolved Keep First Menu Expanded On Load



X-Tream
10-12-2013, 03:23 PM
Hello,

http://netti-tv.net/Sahkoteho/test.html

How do I keep the first one open(expanded) when the page loads?

Upon loading they all are collapsed. I would like to have the first one expanded.

So instead of this:
http://netti-tv.net/Sahkoteho/first.png

It would load the page like this:
http://netti-tv.net/Sahkoteho/second.png

Hopefully somebody could help me out, thanks!

jscheuer1
10-12-2013, 05:19 PM
Add this:


$('.dt1 a').trigger('click');

here:


.live('click',function(){
$(this).addClass('active').parent().siblings().find('>a').removeClass('active').stop().animate({opacity:0})
})
$('.dt1 a').trigger('click');
})
</script>

But that might be too soon. If it is, add it here instead:


$(window).load(function(){

$palkit.animate({marginTop:'0px'}, 350, function(){
$(this).animate({marginTop:'25px'}, 400);});
$palkitDD.css({display:'block'})
$palkitDD.css({display:'none'})
$('.dt1 a').trigger('click');
})

The browser cache may need to be cleared and/or the page refreshed to see changes.

X-Tream
10-12-2013, 05:50 PM
Thank you so much for you help. You are the best!

The first code didn't work, but the second one worked like a charm. :)
http://netti-tv.net/Sahkoteho/test.html

Thought there are a few problems now, as you can see if you press the link above.
1. I believe there should be a small delay before the code is called.
2. The "Etusivu" -button (In english Front page) isn't active (Blue)

Is there a way to fix these problems and if there is could you please help me out.
Thank you again for helping me. I really and truly appreciate it.

Edit. Got the first problem solved by adding this code around the code you gave me.


setTimeout(function() {$('.dt1 a').trigger('click');},775);

jscheuer1
10-12-2013, 08:47 PM
Using a timeout like that is fine.

To get the highlight, add the red code:


$('.dt1 a').trigger('click').css({opacity: 1});

Or, you can trigger the mouseover:


$('.dt1 a').trigger('mouseover').trigger('click');

Which you might like better because it's more gradual.

X-Tream
10-13-2013, 11:06 AM
Thank you again for all of your help! I would have never got it to work with out your help.