How to use the viewerjs/src function in viewerjs

To help you get started, we’ve selected a few viewerjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fengyuanchen / viewer / src / index.js View on Github external
this.each((i, element) => {
      const $element = $(element);
      const isDestroy = option === 'destroy';
      let viewer = $element.data(NAMESPACE);

      if (!viewer) {
        if (isDestroy) {
          return;
        }

        const options = $.extend({}, $element.data(), $.isPlainObject(option) && option);

        viewer = new Viewer(element, options);
        $element.data(NAMESPACE, viewer);
      }

      if (typeof option === 'string') {
        const fn = viewer[option];

        if ($.isFunction(fn)) {
          result = fn.apply(viewer, args);

          if (result === viewer) {
            result = undefined;
          }

          if (isDestroy) {
            $element.removeData(NAMESPACE);
          }

viewerjs

JavaScript image viewer.

MIT
Latest version published 1 year ago

Package Health Score

68 / 100
Full package analysis