Jquery脉动改变颜色或图像

Jquery pulsate changing color or image

本文关键字:图像 变颜色 改变 脉动 Jquery      更新时间:2023-09-26

我试图有一个div改变颜色使用jquery脉动代码,但我希望它从红色变为黑色,但我听说要做到这一点,你必须下载一个插件。所以我想让它脉动成一张图片。到目前为止我有这两个代码:

 <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()方法

也为. pulse()工作,你需要包括jquery UI在你的html文件

我还没有测试过,但它应该可以工作:

$(document).ready(function() {
    $('#white36').click(function () {
          $('#book').effect("pulsate", { times:3000 }, 500);
    });
});
http://docs.jquery.com/UI/Effects/Pulsate