Jquery,背景颜色过渡循环
我希望对背景颜色进行动画处理,以便它在无限循环中循环显示各种预定义颜色。
我不是程序员,而且是 jquery 新手,如果有人能帮助我解决这个问题,我将非常感激
!
I am looking to animate the background-color so it cycles through varios predefined colors in an endless loop.
I am not a programmer and new to jquery, if someone could help me figure this out I would really appreciate ist
thx!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
基于 Byron 的解决方案并使用彩色动画插件:
您可以看到它在此处执行。
Building on Byron's solution and making use of the color animations plugin:
You can see it in action here.
window.setInterval('functionToChangeColour()', 5000);这将每 5000 毫秒运行一次您的函数,按照您希望的方式更改颜色。
您可以分配一个对象 var obj = setInterval('functionToChangeColour()', 5000);如果您喜欢使用 window.clearInterval(obj) ,稍后可以清除间隔
window.setInterval('functionToChangeColour()', 5000); This will run your function every 5000 milliseconds changing the colour the way you'd like it to change.
You can assign an object var obj = setInterval('functionToChangeColour()', 5000); to then later clear the interval if you like using window.clearInterval(obj)