-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwidget.js
41 lines (36 loc) · 1.41 KB
/
widget.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
(function (root, factory) {
if (typeof define === "function" && define.amd) {
define(["mu-jquery-widget/widget"], factory);
} else if (typeof module === "object" && module.exports) {
module.exports = factory(require("mu-jquery-widget/widget"));
} else {
root["mu-jquery-widget-owl/widget"] = factory(root["mu-jquery-widget/widget"]);
}
})(this, function (widget) {
var slice = Array.prototype.slice;
return widget.extend({
"on/initialize": function () {
var me = this;
var $ = me.$;
var $element = me.$element;
["initialize", "initialized", "resize", "resized", "refresh", "refreshed", "drag", "dragged", "translate", "translated", "change", "changed"].forEach(function (event) {
$element.on(event + ".owl.carousel", function ($event) {
$element.trigger($.Event($event, {
type: "owl/" + event,
item: $event.item,
page: $event.page
}), slice.call(arguments, 1));
});
});
["next", "prev", "to", "refresh", "replace", "add", "remove"].forEach(function (method) {
me[me[method] ? method + "$owl" : method] = function () {
$element.trigger(method + ".owl.carousel", arguments);
};
});
$element.on("destroyed", function () {
$element.trigger("destroy.owl.carousel");
});
$element.owlCarousel($element.data("mu-jquery-widget-owl"));
}
});
});