jquery - 使用 jquery attr animate 淡入图像?

标签 jquery attr

当我单击链接时,我设置一个图像 src 来显示图像:

$('img').attr("src",(myPlaylist.playlist[myPlaylist.current].poster));

它按其应有的方式工作,但我想为图像设置动画以使其淡入,我该怎么做?我已经用动画和不透明度进行了测试,但在某个地方出了问题,我无法让它工作。

感谢您的任何意见,谢谢。

最佳答案

试试这个?

首先隐藏它:

$('img').css("display", "none");

然后设置你的src:

$('img').attr("src",(myPlaylist.playlist[myPlaylist.current].poster));

然后淡入:

$('img').fadeIn(500);

关于jquery - 使用 jquery attr animate 淡入图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10226643/

相关文章:

Jquery 启用和禁用 Asp.net 按钮

javascript - jquery ajax 发布到自己不起作用

javascript - AJAX - Javascript 数组到 php

javascript - 如何使用 jQuery 删除一行?

jquery - delay() 和 fadeOut() 不会延迟队列中的 attr()

jquery - jquery 中的复选框验证

javascript - 将 Javascript 变量传递到 JSON 请求

jquery - 根据百分比值更改 CSS 类

jquery 使用 select 中的值更改 attr href

c++ - 跳过规则中的强制性 boost::spirit::qi::attr(0)