我正在尝试使用 jquery 脉动代码让 div 改变颜色,但我希望它从红色变为黑色,但我听说要做到这一点,你必须下载某个插件。所以我希望它脉动为图片。到目前为止我有这两个代码:
<img id="book" src="36.gif" alt="" width="105" height="105"
style="position: absolute; top: 585px;
left:585px;" />
and
<script>
$(document).ready(function() {
$("#white36").click(function () {
$('#book').animate({
$(this).effect("pulsate", { times:3000 }, 500);
});
你错了,你不应该使用 .animate() 方法。
另外,为了使 .pulsate() 工作,您需要在 html 文件中包含 jquery UI。
我还没有测试过,但它应该可以工作:
$(document).ready(function() {
$('#white36').click(function () {
$('#book').effect("pulsate", { times:3000 }, 500);
});
});
http://docs.jquery.com/UI/Effects/Pulsate http://docs.jquery.com/UI/Effects/Pulsate
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)