Javascript 无法使用jquery设置png图像淡出的动画
在我的html中,我有:Javascript 无法使用jquery设置png图像淡出的动画,javascript,jquery,html,animation,Javascript,Jquery,Html,Animation,在我的html中,我有: <div id="testId"> <img src="img/Capture.PNG" alt="0" style=" background-color: red; margin-left:50px; "/> </div> 我也尝试过: $(function () { $("#testId").fadeOut("slow", function () { alert('an
<div id="testId">
<img src="img/Capture.PNG" alt="0" style=" background-color: red; margin-left:50px; "/>
</div>
我也尝试过:
$(function () {
$("#testId").fadeOut("slow", function () {
alert('animation complete');
});
});
而且我的图像没有动画。它从100%可见变为0%
编辑
它在任何浏览器中都不起作用。我试过谷歌浏览器、safari和firefox。。。。真奇怪。我希望我能给你看一段我电脑的视频检查下面的链接,这应该会对你有所帮助
在我无法理解发生了什么之前,我已经使用了jquery 我有两个问题: 1)我想在页面加载时为图像设置动画,因此如果您还记得我这样做过:
$(function () {
$("#testId").fadeOut("slow", function () {
alert('animation complete');
});
});
$(function(){}) executes that function when the dom is done but the image was not loaded yet!. I have to animate the image latter.
2)jquery库jquery-1.4.1.js不工作。我不得不去他们的网站下载最新版本。也许是我无意中修改了文件
编辑
我再次下载了jquery-1.4.1-vsdoc.js版本,以查看我是否意外修改了文件,并且使用该版本时,我的动画无法正常工作……您使用的浏览器是什么?您的第一个示例对我很好:在Chrome 16.0.912.77和FF9.0.1中正常工作。试试评论中的一个链接。我解释了我做错了什么作为答案。谢谢你的帮助!
$(function () {
$("#testId").fadeOut("slow", function () {
alert('animation complete');
});
});
$(function(){}) executes that function when the dom is done but the image was not loaded yet!. I have to animate the image latter.