Jquery脉动改变颜色或图像 [英] Jquery pulsate changing color or image

查看:88
本文介绍了Jquery脉动改变颜色或图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用jquery脉动代码进行div更改颜色,但我希望它从红色变为黑色,但我听说这样做你必须下载某个插件。所以我想要它脉动到一张照片。到目前为止,我有这两个代码:

I'm trying to have a div change colors using the jquery pulsate code but i want it to change from red to black, but i heard to do this you have to download a certain plug in. so instead i want it to pulsate to a picture. so far i have these two codes:

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

you got it wrong, you are not supposed to use the .animate() method.

也可以.pulsate()工作,你需要在你的html文件中包含jquery UI。

also for .pulsate() to work you need to include jquery UI in your html file.

我没有测试它但它应该工作:

I haven't tested it but it should work:

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

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

这篇关于Jquery脉动改变颜色或图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆