Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Drop down menu with title image change

    Hi,

    I have very little knowledge in coding,
    recently I found 2 scripts, (this is only part of the code for each one)

    one creates a Dropmenu with Jquery (slidedown)

    <script type="text/javascript" src="http://static.tumblr.com/3ikgvxs/0TGl4zgpu/jquery.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){
    $(".links_body").hide();
    $(".links_head").click(function(){
    $(this).next(".links_body").slideToggle('fast');
    }); }); </script>


    Other one lets me change the header image as I click it (opens menu) and return to the original image when I click it the 2nd time (close menu). But this one doesn't slide out, it just appears.

    function showhide(layer_ref,imgobj,src1,src2) {
    var hza = document.getElementById(layer_ref);
    var state=hza.style.display!='block';
    hza.style.display = state?'block':'none';
    imgobj.src=state?src2:src1;

    I want to know if it is possible to combine the two, so i can have a slide open drop down menu with the head image that changes when i click it, and returns to original when i click it the 2nd time?

    Any help would be greatly appreciated, Thank You!

  • #2
    Regular Coder
    Join Date
    Sep 2011
    Posts
    330
    Thanks
    3
    Thanked 35 Times in 35 Posts
    so i can have a slide open drop down menu with the head image that changes when i click it, and returns to original when i click it the 2nd time?
    If nobody responds here, I would suggest to make a drawing, on paper and scanned or in a graphics program, prepare to upload it and re-post your question in Web projects.
    Frank

    How to: Target IE in, Position in, Center in, Create a Fixed ('Sticky') Footer with, and Create a Drop-Down/Fly-Out Menu with CSS: Website Laten Maken Amsterdam.

  • #3
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,722
    Thanks
    41
    Thanked 191 Times in 190 Posts
    very possible and should be easy- ask to move to javascript forum or post in there if no one moves it- but essentially what you want to do is have an accordion menu that toggle-swaps images for the "title"/"menu"/"whatever" region... you could do either a simple call to the accordion at the end of the toggle (or beginning) function or you could do a multi call with your onclick.

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE


  •  

    Posting Permissions

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