Results 1 to 5 of 5

Thread: Keep First Menu Expanded On Load

  1. #1
    Join Date
    Apr 2011
    Posts
    23
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Default Keep First Menu Expanded On Load

    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!
    Last edited by X-Tream; 10-13-2013 at 11:06 AM.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Add this:

    Code:
    $('.dt1 a').trigger('click');
    here:

    Code:
    	.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:

    Code:
    $(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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. The Following User Says Thank You to jscheuer1 For This Useful Post:

    X-Tream (10-12-2013)

  4. #3
    Join Date
    Apr 2011
    Posts
    23
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Default

    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.

    Code:
    setTimeout(function() {$('.dt1 a').trigger('click');},775);
    Last edited by X-Tream; 10-12-2013 at 05:59 PM.

  5. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Using a timeout like that is fine.

    To get the highlight, add the red code:

    Code:
    $('.dt1 a').trigger('click').css({opacity: 1});
    Or, you can trigger the mouseover:

    Code:
    $('.dt1 a').trigger('mouseover').trigger('click');
    Which you might like better because it's more gradual.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. The Following User Says Thank You to jscheuer1 For This Useful Post:

    X-Tream (10-13-2013)

  7. #5
    Join Date
    Apr 2011
    Posts
    23
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Default

    Thank you again for all of your help! I would have never got it to work with out your help.

Similar Threads

  1. Replies: 5
    Last Post: 02-12-2010, 03:01 PM
  2. Glossy Accordion Menu -Just want menu to start as expanded
    By Memet in forum Dynamic Drive scripts help
    Replies: 6
    Last Post: 12-06-2008, 07:35 PM
  3. Accordion Menu doesn't start expanded
    By yourstorewizard in forum Dynamic Drive scripts help
    Replies: 6
    Last Post: 04-17-2008, 04:48 AM
  4. Slashdot: first menu expanded at first load
    By Khaspah in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 11-22-2006, 03:58 PM
  5. Switch Menu II: How to view one expanded menu at a time
    By gazanson in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 09-04-2006, 09:23 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •