jquery无限随机图像推子
遗憾的是,我对 jquery 编写完全陌生,在谷歌搜索 12 个小时找到满足我需求的解决方案后,我放弃并立即询问。
我正在尝试编写一个简短的脚本,该脚本会在随机图片中淡出,延迟一点然后淡出。之后,该函数应该被调用到无穷大。
现在我主要遇到的问题是以这样的方式完成回调,它不会严重回归,而是一遍又一遍地调用。我发现的大多数脚本都让我的萤火虫发疯。另外,我还不太明白,如何对随机图像选择器进行排队,一点 attr (所以它并不总是出现在完全相同的位置,而是交替显示一点 - 但这具有低优先级),淡入淡出,延迟、淡出,然后全部重来。
如果有人可以帮助我,我将非常非常感激。 亚历克斯。
sadly i am totally new to jquery-writing and after googling for 12 hours to find a solution for my needs im giving up and ask straight away.
i am trying to write a short script, that fades in a random picture, delays a bit and then fades out. after that, the function should be invoked to infinity.
for now i mostly had the problem to accomplish the callback in such a manner, that its not regressing heavily but calling over and over. most scripts ive found let my firebug go crazy. also, i did not yet quite understood, how i can queue up the random image selector, a bit of attr (so its not always showing up at the exact same spot, but alternating a bit - but that has low priority), fadein, delay, fadeout and then doing it all over.
if someone could help me there, i'd be very, very grateful.
alex.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 jQuery 中非常容易做到:
jQuery
使用
:random jQuery 过滤器选择器的帮助
- 值得注意的是,我添加了这个,因为你说“随机” - 但实际上你可能想要“下一个”图像,因为有时它会选择与上次相同的图像,或者不会为所有图像提供均匀的时间。在这种情况下,您可以使用 http://jsfiddle.net/garreh/7BLnT/小提琴: http://jsfiddle.net/garreh/JbrXd/
Very easy to do in jQuery:
jQuery
Using the help of the
:random jQuery filter selector
-- it's worth noting I've added this in because you said "random" -- but in fact you probably want the "next" image because on occasions it will select the same image as last time, or won't give even time to all images. In which case you can use http://jsfiddle.net/garreh/7BLnT/Fiddle: http://jsfiddle.net/garreh/JbrXd/