有没有什么办法可以让这个图像淡入使用CSS转换定义?现在它只是弹出完全不透明。css点击不透明转换
<script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.0.js"></script>
<style type="text/css">
.fadeIn {
opacity:0;
-moz-transition: opacity 5.5s ease 0.300s;
-webkit-transition: opacity 5.5s ease 0.300s;
-o-transition: opacity 5.5s ease 0.300s;
transition: opacity 5.5s ease 0.300s;
}
</style>
<script>
var makeImage = function() {
$('#image').remove();
$(document.body).append('<img id="image" class="fadeIn" src="http://a57.foxnews.com/global.fncstatic.com/static/managed/img/Scitech/660/371/tardar-sauce-the-cat.jpg?ve=1" />');
var img = $('#image')[0];
console.log(img.style);
img.style["opacity"] = 1;
};
</script>
<title>Fade Example</title>
<input id="makeButton" type="button" value="Make and fade" onclick="makeImage()"; />
编辑:我知道有一个由jquery提供的fadeIn函数。我后悔在这个例子中使用jquery,因为重点是使用CSS转换属性。
如何使用jQuery? fadeIn(5500)会工作 – frenchie