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 4 of 4
  1. #1
    Member
    Join Date
    Jan 2004
    Posts
    62
    Member #
    4758
    I've been trying to get a div with a certain background image to show up only when someone hovers over the div. Could someone tell me why this is not working? I've looked at guides to double check whether I'm using the Java correctly, from what I've seen it looks right but obviously something is wrong. It is not working!

    Code:
    <div style="float: left; width: 85px; height: 130px; border: 0px; margin-top: 75px; margin-left: 7px; visibility: hidden; background-color: red;" onmouseover="this.style.visibility='visible'" onmouseout="this.style.visibility='hidden'" /></div>
    - flipjargendy

  2.  

  3. #2
    Senior Member ceetee's Avatar
    Join Date
    Jul 2003
    Posts
    117
    Member #
    2035
    What's that slash doing in the opening div?

  4. #3
    Member
    Join Date
    Jan 2004
    Posts
    62
    Member #
    4758
    Quote Originally Posted by ceetee
    What's that slash doing in the opening div?
    A CMS I used before added a slash to every tag I had so I thought I'd give it a shot. The code acts the same with or without the slash.

    I figured out a solution... this may be the least effective way to go about it but when a div is set to hidden it will not react to any sort of actions until it is visible. So I created another div directly over the hidden div that did made the hidden div visible onMouseOver and hidden onMouseOut.
    - flipjargendy

  5. #4
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    Yeah... I think elements with visibility: hidden do not receive mouse events the same way other elements do. Also, drop the trailing /; that's only for self-closing elements -- i.e., elements that don't have a matching closing tag, like img and link.


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
  •  
All times are GMT -6. The time now is 05:34 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com