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 2 of 2
  1. #1
    New Coder
    Join Date
    Dec 2009
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Custom Logo and click handlers

    Hi All,

    I'd like to create a custom logo (don't know what yet) that represents the pieces of my project so that a user can click on a piece of the logo and have that associated panel brought forth. I'm not sure how to go about doing this so could someone point me in the right direction?

    Thanks!

  • #2
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,980
    Thanks
    56
    Thanked 557 Times in 554 Posts
    img (graphic) elements can have an onclick attribute, which can be used to fire a function and that would in turn show and hide divs or other images or whatever your panels are. It's very simple and doesn't require alot of the convoluted code that you will find googling on the subject. here's some quasi code that might actually work:

    Code:
    <style>
    .hide{
    display:none;
    }
    </style>
    <img src="logo1.jpg" onclick="showstuff('div1')">
    <img src="logo2.jpg"  onclick="showstuff('div2')">
    
    <div class="hide" id="div1">Div one is here</div>
    <div class="hide" id="div2">Div two is here</div>
    
    
    <script type="text/javascript">
    var shownDiv;
    function showstuff(divID){
    if (shownDiv){
    document.getElementById(shownDiv).style.display="none";
     }  
        document.getElementById(divID).style.display="block";
    	shownDiv=divID;
    }
    
    </script>


  •  

    Posting Permissions

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