Simple onmouseover javascript help, will rep!

Discussion in 'JavaScript' started by MarcL, Dec 12, 2010.

  1. #1
    Ok I have:
    <img src="images/scalethree.gif">

    I want it so when they hover that image a small hovering box appears saying Hello on the image (hovering box isnt at a specific point, but where the image is).

    Should be easy... will give rep
     
    MarcL, Dec 12, 2010 IP
  2. elicitservers

    elicitservers Peon

    Messages:
    714
    Likes Received:
    7
    Best Answers:
    1
    Trophy Points:
    0
    #2
    I'm pretty sure you mean an actual hover box immediately when the mouse is over the image? Because you can always set the alt tag to "Hello", and Hello will appear as a tooltip when you hover with the mouse, but it takes a few seconds to appear.
     
    elicitservers, Dec 12, 2010 IP
  3. elicitservers

    elicitservers Peon

    Messages:
    714
    Likes Received:
    7
    Best Answers:
    1
    Trophy Points:
    0
    #3
    There's plenty of articles online which allow you to add captions using CSS, here's one for example, taken from http://www.thecssninja.com/xhtml/advanced-hover-css

    HTML:
    <a class="feature01" href="#">
    	<span class="overlay01">
    		<span class="caption01">Roll over</span>
    	</span>
    	<img src="images/scalethree.gif" />
    </a>
    Code (markup):
    CSS:
    a.feature01
    {
    	display: block;
    	border: 1px solid #dfd0cb;
    	border-width: 0 1px 1px 0;
    	margin: 20px 20px 1em 20px;
    	float: left;
    	position: relative;
    }
    a.feature01:hover { border-color: #000; }
     
    	a.feature01:hover .overlay01
    	{
    		position: absolute;
    		z-index: 3;
    		width: 194px;
    		height: 200px;
    		border: 3px solid #fff;
    	}
    		a.feature01 .overlay01 .caption01
    		{
    			position: absolute;
    			height: 30px;
    			line-height: 30px;
    			width: 100%;
    			z-index: 3;
    			text-indent: -9999em;
    			color: #000;
    			font-size: 11px;
    			bottom: 0;
    			overflow: hidden;
    		}
    		a.feature01:hover .caption01
    		{
    			text-indent: 10px;
    			background: rgb(255,255,255);
    			/* for browsers that know rgba */
    			background: rgba(255, 255, 255, 0.75);
    		}
    		a.feature01 img { display: block; }
    Code (markup):
     
    elicitservers, Dec 12, 2010 IP
  4. MarcL

    MarcL Notable Member

    Messages:
    4,265
    Likes Received:
    82
    Best Answers:
    0
    Trophy Points:
    215
    #4
    Alt wont work for what I am trying to do in the long run.

    I will try out the other link you sent... thanks.
     
    MarcL, Dec 12, 2010 IP
  5. MarcL

    MarcL Notable Member

    Messages:
    4,265
    Likes Received:
    82
    Best Answers:
    0
    Trophy Points:
    215
    #5
    Ahh looking for another method as the images may be different sizes.
     
    MarcL, Dec 12, 2010 IP
  6. MarcL

    MarcL Notable Member

    Messages:
    4,265
    Likes Received:
    82
    Best Answers:
    0
    Trophy Points:
    215
    #6
    MarcL, Dec 12, 2010 IP