首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在jQuery中创建块过渡

问如何在jQuery中创建块过渡
EN

Stack Overflow用户
提问于 2011-12-15 21:38:13
回答 1查看 1.2K关注 0票数 0

在jQuery中创建块过渡的最佳方法是什么?有没有提供这种转换的插件(只提供转换,我不想要有这样的转换的图片库!)?

我正在寻找类似于http://mitya.co.uk/scripts/Blockster-transition-effect-122或http://codecanyon.net/item/jquery-banner-rotator-slideshow/full_screen_preview/109046的对角扩展块转换

第一个链接的问题是,当使用更多的块时,它非常慢。我不明白在第二个链接上是如何创建转换的。

EN

回答 1

Stack Overflow用户

发布于 2012-01-26 11:16:41

如果您将此代码添加到144行上的blockster.js中,则会有更多的块同时淡入淡出。

代码语言:javascript
复制
/* ------------------
| ANIMATION - with all blocks built, set an interval to turn them all on, one by one.
| When all blocks in position, and all have finished anim (if fade rather than simple)
|   - kill int
|   - shuffle slides so the one our blocks contain parts of is genuinely topmost
|   - remove blocks
------------------ */
    var simultaneous = 5;
for(var i = 0; i < simultaneous; ++i)
{
    addTimer(nextSlide, thiss, i, simultaneous);
}
}

function addTimer(nextSlide, thiss, i, simultaneousBlocks)
{
    setTimeout(function()
    {
    var animInt = setInterval(function() 
        {
        if(thiss.params.holder.children('.block:not(:visible)').length > 0)     
            {
            var blocks = thiss.params.holder.children('.block:not(:visible)');
        with($(blocks.get(!thiss.params.random ? 0 : Math.floor(Math.random() * blocks.length)))) thiss.params.animType == 'simple' ? show() : fadeIn(thiss.params.blockAnimSpeed);
    }
    else if ($('.block:animated').length == 0) 
            {
        clearInterval(animInt);
        nextSlide.siblings().hide();
        nextSlide.show();
        $('.block').remove();
        }
    }, thiss.params.blockAnimSpeed);
}, (thiss.params.blockAnimSpeed / simultaneousBlocks) * i);     
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8520960

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档