Results 1 to 6 of 6

Thread: Is it possible to add individual 'background' images to the Apple Accordion Menu?

  1. #1
    Join Date
    Jun 2010
    Posts
    10
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default Is it possible to add individual 'background' images to the Apple Accordion Menu?

    1) Script Title: Apple Accordion Menu script

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...menu-apple.htm

    3) Describe problem: Probably a tricky thing to do, but I was wondering if it is possible to add individual background pictures to the open menus below the header name.

    I looked at the code and wouldn't even knew where to begin. I don't want the same image appearing twice, and only want one or two with individual background images. In-line images are simple, but are background images possible with this script?

    My apologies if this has been addressed earlier (I did look).

    Many thanks. ~ Raubie

  2. #2
    Join Date
    Oct 2009
    Posts
    845
    Thanks
    14
    Thanked 189 Times in 188 Posts

    Default

    this approach can get you a specific picture in the backgroung of selected menu points
    Code:
    .applemenu div:nth-child(2){ 
    background: url("http://i27.tinypic.com/sy7295.gif"); background-repeat:no-repeat;
    
    }
    .applemenu div:nth-child(4){ 
    background: url("http://i27.tinypic.com/sy7295.gif"); background-repeat:no-repeat;
    
    }
    Try this first, then change the picture url to your images and finally experiment with the number in parenthesis

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

    Raubie (06-18-2010)

  4. #3
    Join Date
    Oct 2009
    Posts
    845
    Thanks
    14
    Thanked 189 Times in 188 Posts

    Default

    Raubie, while this selector works fine in FF, chrome, safari and opera, I just discovered that internet explorer unfortunately doesn't support it. Maybe someone else knows of a better way to select this ? I guess it will work if you do it with jQuery though. I might try this out.
    Last edited by azoomer; 06-17-2010 at 10:43 PM. Reason: typo

  5. The Following User Says Thank You to azoomer For This Useful Post:

    Raubie (06-18-2010)

  6. #4
    Join Date
    Oct 2009
    Posts
    845
    Thanks
    14
    Thanked 189 Times in 188 Posts

    Default

    Alright, this is the same made with jQuery

    Code:
    <script type="text/javascript">
    $(document).ready(function(){
    $('.applemenu div:nth-child(2)').css({
    		 backgroundImage :'url("http://i27.tinypic.com/sy7295.gif")',
    		 backgroundRepeat: 'no-repeat'						
    	});
    });
    </script>
    and it actually works in internet explorer. You can see it here. Well that's my 2 cents worth. Maybe someone else has a smarter solution.

  7. The Following User Says Thank You to azoomer For This Useful Post:

    Raubie (06-18-2010)

  8. #5
    Join Date
    Jun 2010
    Posts
    10
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by azoomer View Post
    this approach can get you a specific picture in the backgroung of selected menu points
    Code:
    .applemenu div:nth-child(2){ 
    background: url("http://i27.tinypic.com/sy7295.gif"); background-repeat:no-repeat;
    
    }
    .applemenu div:nth-child(4){ 
    background: url("http://i27.tinypic.com/sy7295.gif"); background-repeat:no-repeat;
    
    }
    Try this first, then change the picture url to your images and finally experiment with the number in parenthesis
    Quite brilliant, can't wait to try this out!

    Thank you azoomer!

  9. #6
    Join Date
    Jun 2010
    Posts
    10
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by azoomer View Post
    Alright, this is the same made with jQuery

    Code:
    <script type="text/javascript">
    $(document).ready(function(){
    $('.applemenu div:nth-child(2)').css({
    		 backgroundImage :'url("http://i27.tinypic.com/sy7295.gif")',
    		 backgroundRepeat: 'no-repeat'						
    	});
    });
    </script>
    and it actually works in internet explorer. You can see it here. Well that's my 2 cents worth. Maybe someone else has a smarter solution.
    WOW! I'd given up on this working in IE. Got to love jQuery!

    Azoomer, I can't thank you enough for these three changes. I'm realizing how rusty I am.

    Is there any way for the DD admins to add your improvements as addendum to the original post (or code)?

    Thanks so much! ~ Raubie

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
  •