| Welcome to WebmasterWorld Guest from 184.108.40.206 |
register, login, search, subscribe, help, library, PubCon, announcements, recent posts, open posts,
|Subscribe to WebmasterWorld|
|Show Hide text on image rollover|
| 7:23 pm on Sep 28, 2012 (gmt 0)|
//get collapse content selector
var collapse_content_selector = $(this).attr('href');
//make the collapse content to be shown or hide
var toggle_switch = $(this);
to expand a div and show some text on the rollover of an image.
<a href="#collapse1" class="nav-toggle"><img src="images/image_name.jpg" width="298" height="59" alt="image">
<div id="collapse1" style="display:none">my text that is revealed is this section.....</div>
It works well, but using the above code the revealed text above stays in place until you mouseover the image again upon which it is hidden.
I would like to change this so that you still mouseover the image to reveal the text, but as soon as you mouseout it is hidden.
eg. you don't have to mouseover it again to close it.
I'm sure all I need is a simple tweak to the code above, so if you can help asap it would be appreciated!
| 2:26 am on Sep 29, 2012 (gmt 0)|
"onmouseover" to do its stuff while the mouse is over the element
"onmouseout" to stop when the mouse moves away
| 10:32 am on Oct 3, 2012 (gmt 0)|
you can use hoverevent provided by jquery for both events.
[edited by: engine at 11:03 am (utc) on Oct 3, 2012]
[edit reason] no sig files, thanks [/edit]
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
WebmasterWorld ® and PubCon ® are a Registered Trademarks of Pubcon Inc.
© Pubcon Inc. 1996-2012 all rights reserved