Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 5 of 5
  1. #1
    Member
    Join Date
    Jan 2004
    Posts
    62
    Member #
    4758
    Is it possible to use onMousePress and onMouseRelease to make a div visible or hidden? For example onMousePress=visible and onMouseRelease=hidden.

    I haven't found much on this with Google... mostly just forum posts that aren't even dealing with what I'm looking for. This makes me wonder if what I'm going for is even possible.

    I probably didn't have to post code but I did it anyway in case anyone wanted to see what exactly I was doing... if I wasn't clear enough. All of the code works but the onMousePress and onMouseRelease.

    Code:
    <div style="position:absolute; width:85px; height:120px; margin-top:75px; margin-left:7px;" onmouseout="fullMouth.style.visibility='hidden'; ribblets.style.visibility='hidden'; onmouseover="fullMouth.style.visibility='visible'; dribblets.style.visibility='visible'" onmousepress="adict.style.visibility='visible'" onmouserelease="adict.style.visibility='hidden'"><img...blah /></div>
    - flipjargendy

  2.  

  3. #2
    Junior Member zonker's Avatar
    Join Date
    Apr 2007
    Posts
    6
    Member #
    15109
    You can do the rollover fairly easily with CSS.

    #div-id a {display: none;}

    Perhaps there is an "onclick" event that you can mark in here also.

  4. #3
    Senior Member Steax's Avatar
    Join Date
    Dec 2006
    Location
    Bandung, Indonesia
    Posts
    1,207
    Member #
    14572
    If you want to go and pic up jQuery, which is a JS library, you can do something very simple. Like this.

    Markup:
    HTML Code:
    <div id="box">
      <a href=""id="divcloser">Click this to hide box</a>
    </div>
    And the JS:
    Code:
    $(function(){ // Ignore this opening bit for now
    
      $("#divcloser")  // CSS-like selector
         .click(function(){   // Define a click event - jQuery will manage it for you
           $("#box").hide("slow"); // Slowly show the box
        })
    
    }); // Ignore this closing bit for now
    Really doesn't get any simpler than that. If you want an open button, just replicate the script but replace the hide with show. Thats that.
    Note on code: If I give code, please note that it is simply sample code to demonstrate an effect. It is not meant to be used as-is; that is the programmer's job. I am not responsible to give you support or be held liable for anything that happens when using my code.

  5. #4
    Member
    Join Date
    Jan 2004
    Posts
    62
    Member #
    4758
    If you want to go and pic up jQuery, which is a JS library...
    Woah, I just tried a few scripts that are on the jQuery website and it is amazing! I'm going to give it a shot.

    Thanks for the link.
    - flipjargendy

  6. #5
    Senior Member Steax's Avatar
    Join Date
    Dec 2006
    Location
    Bandung, Indonesia
    Posts
    1,207
    Member #
    14572
    Glad you enjoy it. Feel free to ask if you have any questions... I usually answer most JS-related questions through jQuery code, anyway. It's always several times shorter than it'd be in plain JS.
    Note on code: If I give code, please note that it is simply sample code to demonstrate an effect. It is not meant to be used as-is; that is the programmer's job. I am not responsible to give you support or be held liable for anything that happens when using my code.


Remove Ads

Posting Permissions

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

Search tags for this page

html onmouserelease
,
javascript onmousepress
,
javascript onmouserelease
,
jquery onmousepres
,
jquery onmousepress
,
onclick onmousepress
,

onmousepress

,
onmousepress in jquery
,
onmousepress javascript
,

onmouserelease

Click on a term to search for related topics.
All times are GMT -6. The time now is 09:02 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com