簡體   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