1

I have found one really nice thing on themeforest. However I am not interested in anything but that jquery background shuffle.

http://themeforest.net/item/launch-pad-full-screen-image-under-construction/full_screen_preview/473421

I thought to buy it but then I've noticed that guy put all scripts into one .js so I wouldnt understand quite mutch to remove all of these.

However... I was wondering if anyone can help me to make something like that without any of the options like on preview website.

I just want to have this fadeIn, fadeOut effect and two images to shuffle between 6 seconds. Sounds quite easy to make, but not without knowledge.

I will keep searching if something like that exists, thanks in advance. Cheers.

4

2 回答 2

2

JQuery 的淡入功能记录在这里: http ://api.jquery.com/fadeIn/

我会这样做:

  1. 创建新图像
  2. 使用 JQuery 隐藏它 .hide
  3. 将其插入文档中与旧图像完全相同的位置,使其位于其上方。
  4. 在新图像上调用 .fadeIn
  5. 在我传递给 .fadeIn 的回调例程中,我删除了下面的图像,这样图像就不会无限堆叠并占用浏览器资源
于 2012-09-04T14:19:10.260 回答
0

这是一个旧答案,但对于现在正在寻找它的人,您可以尝试 bgshuffle 脚本。它使用 JqueryUI。您必须在页面中的某处包含 JqueryUI。该脚本发布在 github 上,如果您喜欢,请随时扩展它:

https://github.com/vikaskumarsingh123/bgshuffle/

您可以简单地将其称为

shuffleBG( ['1.jpg','2.jpg','3.jpg','4.jpg','5.jpg'] );//the array of wallpapers

或高级用法:

shuffleBG(['1.jpg','2.jpg','3.jpg','4.jpg','5.jpg'], //the array of wallpapers
        '10000', //time between wallpaper change, defaults to 10000ms (10secs)
        '1000', //fade in fade out animation speed, defaults to 1000ms
        'white' //color to fade in and out of, defaults to body backgroundColor or white
);

您通常会在 document.load 上调用此函数。

于 2017-06-01T07:46:01.223 回答