繁体   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... }

}

为什么“做某事”适用于Chrome但不适用于Firefox 16和Internet Explorer 9? 如果我删除它的if条件,但我需要它,所以我无法删除。 这是css

div.myclassname span {...; font-weight:normal ; ...}

尝试,

if($(this).children('span').css('font-weight')=='400')

要么

if($(this).children('span').css('font-weight')==400)

在这里查看http://jsfiddle.net/muthkum/qpEK2/2/ font-weight在JS中返回400。

尝试这个:

if($(this).children('span').eq(0).css('font-weight')=='normal')

你能在jsfiddle中设置它吗? 请问:

$('.myclassname').mouseover(function(){
    $('span',$(this)).each(function(){
      if($(this).css('font-weight')=='normal'){
       //do something
      }
    });
});

工作?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM