Reputation:
I was having trouble getting my IE only stylesheet to load, so I settled for some IE only inline javascript.
But this isn't working either. Could someone have a look at my code and tell me what I'm doing wrong? I currently have it placed in a script tag at the end of my html document right above the my closing html tag.
Here is my code:
<script>
if ($.browser.msie && $.browser.version < 8) {
// IE 7 or older
$('.sidecolor, .EDGE-15678806, .edge-wrapper').css("display", "none");
$('.MobileBanner').css("display", "block");
} else {
// all other browsers
$('.sidecolor, .EDGE-15678806, .edge-wrapper').css("display", "block");
$('.MobileBanner').css("display", "none");
}
</script>
Upvotes: 0
Views: 831
Reputation: 3792
First of all, I suggest you use this as a simple test, you can insert your code between the script
tags once you see this working for you:
<!--[if lt IE 8]>
<script>
alert("This is some version of IE, either 7 or below, so very not awesome!);
/*Your code here*/
</script>
<!--[if (gte IE 8) | (!IE)]><!-->
<script>
alert("This is some version of IE, either 8 or above, much better!);
/*Your code here*/
</script>
<!--<![endif]-->
Let me know if this helped. If it did not then it could have something to do with your elements or your CSS styling and that is another question entirely.
Reference to further tests: MSDN 'About conditional comments'
Upvotes: 2