开发者

taking full advantage of jquery 1.4 feature detection

I am specifically trying to target IE 6/7/8 and PREVENT those versions from recognizing the fadeIN effect in my javascript file.

Can anyone please help me implement this?

http://iamwhitebox.com/staging/arkitek

I had a snippet that looked like this to start with, but I dont know where to add it:

var FADE_TIME = 500; if(!($.support.opacity)) { FADE_TIME = 0}

$('element').fadeOut(F开发者_开发百科ADE_TIME)


first, put all of your content in a div element, and in a style sheet, set that element's opacity to 0. Then, with javascript, if the user's browser isn't IE, fade in, other wise just set it's opacity to 1. you could put it in document.ready or document.onload.

if(navigator.userAgent.indexOf('MSIE')==-1)
        //if we are not using IE
    $('element').fadeIn(500);
        //fade out
else
    $('element').css('opacity', '1')
        //set opacity to 0 if we are using IE

If you want to base it off fadeIn actually working, instead of being based directly of if the browser is IE, then just replace navigator.userAgent.indexOf('MSIE')==-1 with $.support.opacity ($.support.opacity is a better idea).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜