jQuery的GIF雪2 GIF动画 [英] Jquery gif snow with 2 animated gifs

查看:246
本文介绍了jQuery的GIF雪2 GIF动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我有2这里的GIF不同雪GIF动画:

Hi I have a snow gif animation with 2 different gifs here:

http://archibaldbutler.com/projects/stack/

一是下雪而不是其他的,我想他们的两个以雪花在页面而不是一个在present。

One is snowing but not the other, I want them both to "snow" down the page instead of just one, at present.

我也跟着教程仅适用于有一个GIF动画。所以我复制了降雪脚本,并把它命名为snowfall2.jquery.js

The tutorial I followed was only for having one animated gif. So I duplicated the snowfall script and named it snowfall2.jquery.js

    <script src='snowfall.jquery.js'></script>
<script src='snowfall2.jquery.js'></script>

我做了搜索和替换内部snowfall2与snowfall2取代降雪。

I did a search and replace inside snowfall2 for replacing "snowfall" with "snowfall2".

在我的index.html的头,我已经添加了调用GIF图像调用snowfall2.jquery.js:

In the header of my index.html, I have added the call to snowfall2.jquery.js which calls the gif image:

<script type='text/javascript'>     
    $(document).ready(function(){
        $('.collectonme').hide();
        //Start the snow default options you can also make it snow in certain elements, etc.
        $(document).snowfall({image :"images/santa-sneaking-smiley-emoticon2.gif", minSize: 40, maxSize:100});
  $(document).snowfall2({image :"images/santa-sneaking-smiley-emoticon22.gif", minSize: 40, maxSize:100});



    });
     </script>

我的问题是:一个GIF:鬼鬼祟祟的圣诞老人下雪了下来,但跳跃圣诞老人是不是下雪。为什么呢?

My question is: One gif: the sneaking santa is "snowing" down, but the jumping Santa isn't "snowing". Why?

推荐答案

我假设 snowfall.jquery.js snowfall2.jquery .js文件是相同的文件的副本。

I'm assuming that snowfall.jquery.js and snowfall2.jquery.js are copies of the same file.

如果是这样的话,你还只是加载同一个文件。如果它们具有不同的名字也没关系。

If that's the case, you still just loading the same file twice. It doesn't matter if they have different names.

函数/变量名是在这两个文件中相同的,所以只有功能的人会得到执行,而不是两个。这就是为什么只有一个图像飘雪。至于固定不言而喻。我帮不了你,因为我不知道的jQuery插件的内容。

The function/variable names are the same in both the files so only one of the function will ever get executed, not both. Which is why just one image is "snowing". As far as fixing it goes. I can't help you as I don't know the contents of the jquery plugin.

如果该文件是足够小,你可以通过它,所以有每个人的两个实例重命名所有的全局变量和函数。

If the file is small enough, you can go through it and rename all the global variable and functions so that there are two instances of each one.

这篇关于jQuery的GIF雪2 GIF动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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