Browser detection and addClass
This doesn't work
if( $.browser.opera ){
$("body"开发者_如何学运维).addClass('opera');
}
why?
Have you tried
if( $.browser.opera ){
$("body").attr("class", "opera");
}
There is no problem using addClass. When opera loads there is no 'opera' class in body when I view sourcecode, but when I add in CSS body.opera{display:none;} it's executed. So problem is in browser. Browser doesn't make jQuery changes in user visible source code of browser.
精彩评论