[英]Jquery/Javascript and Css condition doesn't work on firefox and IE. It works on Chrome
$('.myclassname').mouseover(function(){
if($(this).children('span').css('font-weight')=='normal')
{..do something... }
}
Why the "do something" works on Chrome but not on Firefox 16 and Internet Explorer 9? 为什么“做某事”适用于Chrome但不适用于Firefox 16和Internet Explorer 9? If I delete the if condition it works, but I need it so I can't delete. 如果我删除它的if条件,但我需要它,所以我无法删除。 Here's the css 这是css
div.myclassname span {...; font-weight:normal ; ...}
Try, 尝试,
if($(this).children('span').css('font-weight')=='400')
or 要么
if($(this).children('span').css('font-weight')==400)
check here http://jsfiddle.net/muthkum/qpEK2/2/ font-weight
return 400 in JS. 在这里查看http://jsfiddle.net/muthkum/qpEK2/2/ font-weight
在JS中返回400。
尝试这个:
if($(this).children('span').eq(0).css('font-weight')=='normal')
Can you set it up in jsfiddle? 你能在jsfiddle中设置它吗? Does: 请问:
$('.myclassname').mouseover(function(){
$('span',$(this)).each(function(){
if($(this).css('font-weight')=='normal'){
//do something
}
});
});
Work? 工作?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.