2013-10-21 72 views
-2

沒有顯示我有這小小的代碼,但使用jQuery的功能動畫沒有get顯示透明度,我覺得代碼it's罰款,但沒有工作,故障得到動畫功能不透明度:jQuery的不透明度爲div

This's我的代碼

$("#slider_zone_infor").css({ 
    "height":""+show_infor_sliders_h+"px", 
    "line-height":""+show_infor_sliders_h+"px" 
}).show(100).animate({opacity:1},350); 

我想如果你正在使用表明,該區域並打開透明

+0

爲什麼秀()和動畫()?爲什麼不fadeIn()? – isherwood

回答

0

如果您正在使用

<script type="text/javascript"> 
    var show_infor_sliders_h = "234"; 
    var show_infor_sliders_h = "200"; 
    $(document).ready(function(e) { 


    $("#slider_zone_infor").css({ 
    "height":"'"+show_infor_sliders_h+"px'", 
    "line-height":"'"+show_infor_sliders_h+"px'" 
}).show(100).animate({opacity:1},350); 

    }); 
    </script> 

HTML

<div id="slider_zone_infor" class="hide"> 
    Hi there 
    </div> 

那麼你的代碼將正常工作

.hide{ 
display:none; 
} 

比這更是確定:

$("#slider_zone_infor").css({ 
    "height":"'"+show_infor_sliders_h+"px'", 
    "line-height":"'"+show_infor_sliders_h+"px'" 
}).show(100); 

關鍵點:

你只能做opacity:0 to opacity:1display:none to display:block,,或者您也可以使用fadeIn and fadeOut

但你不能做opacity:0 to display:block