UNPKG

imageviewer_terrydr

Version:

A simple jQuery image viewing plugin.

38 lines (29 loc) 849 B
// Save the other viewer Viewer.other = $.fn.viewer; // Register as jQuery plugin $.fn.viewer = function (options) { var args = toArray(arguments, 1); var result; this.each(function () { var $this = $(this); var data = $this.data(NAMESPACE); var fn; if (!data) { if (/destroy|hide|exit|stop|reset/.test(options)) { return; } $this.data(NAMESPACE, (data = new Viewer(this, options))); } if (isString(options) && $.isFunction(fn = data[options])) { result = fn.apply(data, args); } }); return isUndefined(result) ? this : result; }; $.fn.viewer.Constructor = Viewer; $.fn.viewer.setDefaults = Viewer.setDefaults; // No conflict $.fn.viewer.noConflict = function () { $.fn.viewer = Viewer.other; return this; };