I want to test if IE is version 7 or 8 and if it is prevent a specific piece of code running?
I’ve tried the following code but this doesnt seem to work:
if($.browser.msie && parseInt($.browser.version, 10) <= 8) {
$(document).on('mouseenter', '.thumb', function () {
$(this).find('.bgg').stop().animate({ opacity : 1 });
});
$(document).on('mouseleave', '.thumb', function () {
$(this).find('.bg').stop().animate({ opacity : .5 });
});
}
Ideally I really dont want to use this kind of detection but in this case it has to be used.
I’ve had to UA sniff for IE in my projects due to the requirement of having only one script file. We don’t want the extra http request that @Kolink’s method requires, nor do we want to split functionality. For that I would simply use:
and then do whatever you want by using:
I’ve got a jsFiddle that shows several different IE detections up to IE10 just to demonstrate.