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

Why iScroll 5 use as a dependancy #21

Open
englishextra opened this issue Feb 15, 2016 · 2 comments
Open

Why iScroll 5 use as a dependancy #21

englishextra opened this issue Feb 15, 2016 · 2 comments

Comments

@englishextra
Copy link

englishextra commented Feb 15, 2016

It's rather big library. What is it for?

We have a jQuery which is already fat enough. And I have already a bootstrap.

Is there a way to have drawer work at least without iScroll 5 ?

So quick edit gave me drawer work without iscroll

yeah I see what iscroll does, but i need to cut expenses:

Well is it possible to smth like jquery-drawer-iscroll-free.min.js ?

/*!
 * modified so that not to use iScroll v5.1.3 github.com/cubiq/iscroll/blob/master/build/iscroll-lite.js
 * cdnjs.cloudflare.com/ajax/libs/iScroll/5.1.3/iscroll-lite.min.js
 * see why here github.com/blivesta/drawer/issues/21
 * gist here gist.github.com/englishextra/576a35c711f4f81fabe3
 * jquery-drawer v3.1.0
 * Flexible drawer menu using jQuery, iScroll and CSS.
 * http://git.blivesta.com/drawer
 * License : MIT
 * Author : blivesta <[email protected]> (http://blivesta.com/)
 */
!function (e) {
    "use strict";
    "function" == typeof define && define.amd ? define(["jquery"], e) : "object" == typeof exports ? module.exports = e(require("jquery")) : e(jQuery)
}
(function (e) {
    "use strict";
    var t = "drawer",
    n = "undefined" != typeof document.ontouchstart,
    s = {
        init : function (n) {
            return n = e.extend({
                    /* iscroll : {
                        mouseWheel : !0,
                        preventDefault : !1
                    }, */
                    showOverlay : !0
                }, n),
            s.settings = {
                state : !1,
                "class" : {
                    nav : "drawer-nav",
                    toggle : "drawer-toggle",
                    overlay : "drawer-overlay",
                    open : "drawer-open",
                    close : "drawer-close",
                    dropdown : "drawer-dropdown"
                },
                events : {
                    opened : "drawer.opened",
                    closed : "drawer.closed"
                },
                dropdownEvents : {
                    opened : "shown.bs.dropdown",
                    closed : "hidden.bs.dropdown"
                }
            },
            this.each(function () {
                var o = this,
                r = e(this),
                a = r.data(t);
                if (!a) {
                    n = e.extend({}, n),
                    r.data(t, {
                        options : n
                    });
                    /* var i = new IScroll("." + s.settings["class"].nav, n.iscroll); */
                    n.showOverlay && s.addOverlay.call(o),
                    e("." + s.settings["class"].toggle).on("click." + t, function () {
                        return s.toggle.call(o)/* ,
                        i.refresh() */
                    }),
                    e(window).resize(function () {
                        return s.close.call(o)/* ,
                        i.refresh() */
                    })/* ,
                    e("." + s.settings["class"].dropdown).on(s.settings.dropdownEvents.opened + " " + s.settings.dropdownEvents.closed, function () {
                        return i.refresh()
                    }) */
                }
            })
        },
        addOverlay : function () {
            var t = e(this),
            n = e("<div>").addClass(s.settings["class"].overlay + " " + s.settings["class"].toggle);
            return t.append(n)
        },
        toggle : function () {
            var e = this;
            return s.settings.state ? s.close.call(e) : s.open.call(e)
        },
        open : function (o) {
            var r = e(this);
            return o = r.data(t).options,
            n && r.on("touchmove." + t, function (e) {
                e.preventDefault()
            }),
            r.removeClass(s.settings["class"].close).addClass(s.settings["class"].open).css({
                overflow : "hidden"
            }).drawerCallback(function () {
                s.settings.state = !0,
                r.trigger(s.settings.events.opened)
            })
        },
        close : function (o) {
            var r = e(this);
            return o = r.data(t).options,
            n && r.off("touchmove." + t),
            r.removeClass(s.settings["class"].open).addClass(s.settings["class"].close).css({
                overflow : "auto"
            }).drawerCallback(function () {
                s.settings.state = !1,
                r.trigger(s.settings.events.closed)
            })
        },
        destroy : function () {
            return this.each(function () {
                var n = e(this);
                e(window).off("." + t),
                n.removeData(t)
            })
        }
    };
    e.fn.drawerCallback = function (t) {
        var n = "transitionend webkitTransitionEnd";
        return this.each(function () {
            var s = e(this);
            s.on(n, function () {
                return s.off(n),
                t.call(this)
            })
        })
    },
    e.fn.drawer = function (n) {
        return s[n] ? s[n].apply(this, Array.prototype.slice.call(arguments, 1)) : "object" != typeof n && n ? void e.error("Method " + n + " does not exist on jQuery." + t) : s.init.apply(this, arguments)
    }
});
/*!
 * init
 */
"undefined"!==typeof window.jQuery&&$(document).ready(function() {
    $(".drawer").drawer();
});
@gdelhumeau
Copy link

Locally, iScroll has no effect on my Android phone (Android 2.3.6) and my Android Tablet (Android 4.4.4). I don't see the necessity of using it.

@mesnitu
Copy link

mesnitu commented May 3, 2016

Hi. I' using drawler with foundation 6 drilldown menu ( for version 6.3 with auto-height).
Quite a big file too.
So, is this possible ?
Thanks

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

3 participants