1

我正在尝试使用 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);
});
4

1 回答 1

0

你错了,你不应该使用 .animate() 方法。

同样要让 .pulsate() 工作,您需要在 html 文件中包含 jquery UI。

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

$(document).ready(function() {
    $('#white36').click(function () {
          $('#book').effect("pulsate", { times:3000 }, 500);
    });
});

http://docs.jquery.com/UI/Effects/Pulsate

于 2013-03-06T00:00:43.423 回答