jQuery插件Filterizr

时间:2018-11-14 14:16:03

标签: jquery

我尝试使用Jquery插件filterizr过滤我的画廊。 但是在我的浏览器控制台中,我得到了错误:

  

未捕获的TypeError:无法读取未定义的属性'className'       在n.fn.init.t.fn.filterizr(jquery.filterizr.min.js:457)       在HTMLDocument。 (controls.js:5)       在我(jquery-1.12.0.min.js:2)       在Object.fireWith [as resolveWith](jquery-1.12.0.min.js:2)       在Function.ready(jquery-1.12.0.min.js:2)       在HTMLDocument.K(jquery-1.12.0.min.js:2)

第457行如下所示:

       var e = "." + t.trim(this.get(0).className).replace(/\s+/g, "."),
                r = arguments;

怎么了?

编辑

        function(t) {
        if (!t) throw new Error("Filterizr requires jQuery to work.");
        Object(l.a)(), t.fn.filterizr = function() {


            var e = "." + t.trim(this.get(0).className).replace(/\s+/g, "."),
                r = arguments;
            if (!this._fltr && 0 === r.length || 1 === r.length && "object" === u(r[0])) {
                var o = r.length > 0 ? r[0] : a.a;
                this._fltr = new n.a(e, o)
            } else if (r.length >= 1 && "string" == typeof r[0]) {
                var s = r[0],
                    l = Array.prototype.slice.call(r, 1),
                    c = this._fltr;
                switch (s) {
                    case "filter":
                        return c.filter.apply(c, i(l)), this;
                    case "insertItem":
                        return c.insertItem.apply(c, i(l)), this;
                    case "toggleFilter":
                        return c.toggleFilter.apply(c, i(l)), this;
                    case "sort":
                        return c.sort.apply(c, i(l)), this;
                    case "shuffle":
                        return c.shuffle.apply(c, i(l)), this;
                    case "search":
                        return c.search.apply(c, i(l)), this;
                    case "setOptions":
                        return c.setOptions.apply(c, i(l)), this;
                    case "destroy":
                        return c.destroy.apply(c, i(l)), delete this._fltr, this;
                    default:
                        throw new Error("Filterizr: " + s + " is not part of the Filterizr API. Please refer to the docs for more information.")
                }
            }
            return this
        }
    }

0 个答案:

没有答案