jquery - Fancybox,自定义开放过渡

标签 jquery fancybox modal-dialog

有谁知道如何使用自定义打开过渡打开 fancyBox:

http://fancyapps.com/fancybox/

我希望实现与此处示例类似的转换:

http://www.zurb.com/playground/reveal-modal-plugin

我喜欢 Reveal 插件,但它没有一些我需要 fancyBox 为新项目提供的功能

非常感谢,

山姆

最佳答案

添加自定义过渡 -

(function ($, F) {
    F.transitions.dropIn = function() {
        var endPos = F._getPosition(true);

        endPos.top = (parseInt(endPos.top, 10) - 200) + 'px';

        F.wrap.css(endPos).show().animate({
            top: '+=200px'
        }, {
            duration: F.current.openSpeed,
            complete: F._afterZoomIn
        });
    };

    F.transitions.dropOut = function() {
        F.wrap.removeClass('fancybox-opened').animate({
            top: '-=200px'
        }, {
            duration: F.current.closeSpeed,
            complete: F._afterZoomOut
        });
    };

}(jQuery, jQuery.fancybox));

像这样使用它们 -

$(".fancybox").fancybox({
    openMethod : 'dropIn',
    openSpeed : 250,

    closeMethod : 'dropOut',
    closeSpeed : 100
});

哇啦 - 同样的效果!

关于jquery - Fancybox,自定义开放过渡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8356669/

相关文章:

jQuery Thickbox 或者类似的来显示 iFrame?

c# - 使用 asp.net 打开新窗口

javascript - 从另一个组件打开模态点击 react js

jquery - Cordova &jquery :value sent to another static html page

javascript - 如何将 jQuery 单击事件添加到 Django 管理保存并继续按钮?

jquery - Fancybox可见性问题

Javascript Replace() 函数添加奇怪的字符

jquery - 在 jQuery 幻灯片动画期间未显示比其父元素宽的元素

javascript - 使用 hide、prop、attr 或 css 与 JQuery 隐藏元素之间的区别

javascript - json2html,我需要将点击事件添加到生成的html中