Jump to content

[solved]conditional Comments


glopal

Recommended Posts

So, I'm trying to implement this feature on my website and it have work on all browsers. If your interested, you can look at the thread here where I was figuring out how to get it working in the first place.Anyways, it seems to work across the board, except on IE7. Now I could spend a lot of time and energy trying to find a fix, but instead I just want it to not show in IE7, as it is really only for looks.I think I can get it implemented entirely with javascript. So how would I get the an external javascript not to run in IE7. I found a conditional comment to not do something if it is any version of IE, but it doesnt seem as if you can have a "if !IE 7" comment.Heres a run down of what im doing, incase you can see a better solution.Essentially, its an <img> with some style applied to it. Since the image is at the top of the page, I'm just going to do:

document.write("<img id='bg' src='images/bgLines.jpg'/>");

Then apply the style to bg id, either through javascript, or with a different stylesheet for IE7.But I dont want the img there if the browser is ie7.Any ideas?

Link to comment
Share on other sites

below will hide img with id="bg", or you could link to external css style sheet with #bg {display: none;} within it, if browser is IE7.<!--[if IE 7]><style type="text/css">#bg {display: none;}</style><link rel="stylesheet" type="text/css" href="ie7.css" /><![endif]-->

Link to comment
Share on other sites

Thanks, but I actually found my own solution.

<!--[if ! IE 7]><!-->	<script type="text/javascript">document.write("<img id='bg' src='images/bgLines.jpg'/>");var pagePercent= (300 / window.innerHeight) * 100;var bg=document.getElementById('bg');bg.style.height = pagePercent + "%";	</script><!--<![endif]-->

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...