Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-02-2007, 09:41 PM   PM User | #1
Makaveli19
New to the CF scene

 
Join Date: Sep 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Makaveli19 is an unknown quantity at this point
Javascript to make the div visible in IE

Hello,

I was wondering if anybody knew the proper coding in order to make a Div visible if the users browser is IE?

I have a situation on my site that involves an iframe opening inside a hidden div on hover. Apparently there is a hover bug in IE that doesn't allow this action.

I have read the solution is;

Quote:
The IE7 :hover bug can be mitigated by placing a hidden div behind the element. Use javascript to make the div visible if the browser is IE 7. The div needs to be wider & higher than the element and must have a background-color. Add filter: (opacity=1) if you don't want the div to be seen.

The net result here is that when the mouse is moved from element it hits the div, which fires the mouseout event (removes the :hover alteration).

Remember to hide the div again on mouseout.
Does anybody know how this is done?

Thanks in advance, any help is appreciated!
Makaveli19 is offline   Reply With Quote
Old 09-03-2007, 05:38 AM   PM User | #2
iota
Registered User

 
Join Date: Oct 2004
Posts: 592
Thanks: 0
Thanked 1 Time in 1 Post
iota is an unknown quantity at this point
[code]
<div id="eg"></div>

document.getElementById('eg').style.display = 'block';
OR
document.getElementById('eg').style.visibility = 'visible';
/[code]
iota is offline   Reply With Quote
Old 09-03-2007, 06:20 AM   PM User | #3
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,451
Thanks: 0
Thanked 496 Times in 488 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
If you want something visible only in IE then set it as hidden in the stylesheet and then you can the following code to make it visible in IE (which runs JScript instead of JavaScript and therefore understands JScript conditional comments):

Code:
/*@cc_on 
   @if (@_jscript) 
       document.getElementById('eg').style.visibility = 'visible';
@end @*/
If you specifically need to test for IE7 then add a test for @_jscript_version >= 5.6 to the if statement.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:11 PM.


Advertisement
Log in to turn off these ads.