jQuery 循环同时淡入淡出
我在使用 jQuery Cycle Lite 插件 (http://jquery.malsup.com/cycle/) 时遇到问题。
图像似乎在淡入之前完全淡出,我希望它们同时淡入/淡出。 http://hardingandwhitlock.com/v6/content/background
我将同步选项设置为 1
$.fn.cycle.defaults = {
timeout: 2000,
speed: 200,
next: null,
prev: null,
before: null,
after: null,
height: 'auto',
sync: 1,
fit: 0,
pause: 0,
delay: 0,
slideExpr: null
};
非常感谢任何帮助!
I am having an issue with the jQuery Cycle Lite Plugin (http://jquery.malsup.com/cycle/)
The images seem to be fading out completely before fading in, and I want them to fade in/out simultaneously. http://hardingandwhitlock.com/v6/content/background
I have the sync option set to 1
$.fn.cycle.defaults = {
timeout: 2000,
speed: 200,
next: null,
prev: null,
before: null,
after: null,
height: 'auto',
sync: 1,
fit: 0,
pause: 0,
delay: 0,
slideExpr: null
};
any help is much appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
听起来您正在尝试从一张图像到另一张图像进行淡入淡出过渡。为此,您需要使用两个图像:
将
#backImg
设置为#frontImg
后面,如下所示:然后淡出正面图像...这将自动执行您的交叉淡入淡出效果,因为背面图像已加载在其后面。淡入淡出完成后,将前图像的源设置为后图像的 src,显示它,并将下一个图像预加载到后图像中:
这一切都假设您的图像大小相同。如果没有,您需要对 css 进行更精细的处理,并将图像包装在淡出的 div 中。
It sounds like you are trying to do a cross-fade transition from one image to another. To do this, you'll want to use two images:
Set
#backImg
to be behind#frontImg
like so:Then fadeOut the front image... this will automatically do your crossfade effect because the back image is already loaded behind it. When the fade is done, set the source of the front image to the back image's src, show it, and pre-load the next image into the back image:
This all assumes your images are identically sized. If not, you'll want to be just a little more elaborate with the css and wrap the images in divs that fade out.
这最终是由于在
标记之间插入了一些
造成的,并且脚本也在所有标记之间淡入/淡出这些内容。图像该网站是在 Drupal 中完成的,因此图像应该插入正文中,而
不是在单独的行中,
Drupal 似乎在每个单独的行之间插入
。不确定其他 CMS 是否也会这样做This ended up being caused by some
<br>
being inserted between the<img>
tags, and the script was fading those in/out as well in between all the imagesThe site is being done in Drupal, so the images should be inserted into the body as
instead of on separate lines
Drupal seems to insert
<br>
between each separate line. Not sure if other CMS will do the same