简体   繁体   English

Jquery / Javascript和Css条件在firefox和IE上不起作用。 它适用于Chrome

[英]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.

相关问题 jQuery模糊在Firefox和Chrome中不起作用,但在IE9中起作用 - Jquery blur doesn't work in Firefox and Chrome but works in IE9 Javascript不适用于Chrome和Firefox,但适用于IE - Javascript doesn't work on Chrome and Firefox, but works on IE JavaScript时钟可在Chrome上使用,但不适用于Firefox或IE - JavaScript clock works on Chrome but doesn't work with Firefox or IE JavaScript代码在chrome上有效,在IE和Firefox上无效 - JavaScript code works on chrome, doesn't work on IE and firefox Javascript 自动完成功能适用于 IE 和 Chrome,不适用于 Firefox - Javascript autocomplete works in IE and Chrome, doesn't work in Firefox 该Javascript在IE中不起作用,但在Chrome,Firefox和Opera中起作用 - This Javascript doesn't work in IE but works in Chrome, Firefox and Opera jQuery不适用于Firefox,但适用于Chrome - jQuery doesn't work on Firefox but works on Chrome Javascript仅在IE Quirks,7和Chrome和Firefox中有效。 在IE 8或9标准中不起作用 - Javascript only works in IE Quirks, 7 and Chrome and Firefox. Doesn't work in IE 8 or 9 Standards 锚标记中的Javascript在FireFox和IE中不起作用。 可以在Chrome浏览器中使用 - Javascript in anchor tag not working in FireFox and IE. Does work in Chrome Javascript / jQuery无法在Firefox,Safari和IE中运行。 精通Opera和Chrome - Javascript/jQuery not working in Firefox, Safari and IE. Fine in Opera and Chrome
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM