Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

leanModal with zepto instead of jQuery #43

Open
sheffieldnikki opened this issue May 15, 2014 · 0 comments
Open

leanModal with zepto instead of jQuery #43

sheffieldnikki opened this issue May 15, 2014 · 0 comments

Comments

@sheffieldnikki
Copy link

To get leanModal working as a zepto plugin, a few small changes are needed:

    // Zepto doesn't have $.fn.extend()
    //$.fn.extend({ 
    $.fn.leanModal = function(options) {

and

                // Zepto doesn't have .outerWidth(), and modal_height not used!
                //var modal_height = $(modal_id).outerHeight();
                //var modal_width = $(modal_id).outerWidth();
                var el = $(modal_id);
                el.css({'display': 'block', 'opacity': 0});
                var modal_width = (typeof el.outerWidth != 'function') ? el.width() : el.outerWidth();

.width() returns 0 if the modal is display:none, so 'display' it first, but transparent.

})(window.jQuery || window.Zepto);

You will need the core zepto.js library, as well as the zepto.fx.js and zepto.fx_methods.js plugins, for the fadeIn/Out animation to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant