Skip to content
This repository has been archived by the owner on May 22, 2020. It is now read-only.

Plugin is defined but does not automatically enable #160

Open
groblerf opened this issue Jan 13, 2016 · 4 comments
Open

Plugin is defined but does not automatically enable #160

groblerf opened this issue Jan 13, 2016 · 4 comments
Labels

Comments

@groblerf
Copy link

Additional java script is required to "activate" the plugin. This should rather happen as part of the inclusion of the plugin.

It is simple to do, just:

  • link the constructor on the prototype
  • link the constructor on the plugin
  • link the bootstrap data-api
  • add a no conflict (just in case)
@ashleydw
Copy link
Owner

What do you mean "activate"? Do you mean include the delegate code that is in the documentation under "Implementation"?

This is how it was originally but it can cause conflicts with other libraries so was removed.

@groblerf
Copy link
Author

Hi Ashley,
Yes that is what I mean.
Is'nt it better to just add a "NoConflict" function that can be used by those where a conflict exists?
Add a variable before the plugin is declared to that any old conflicting plugin can be returned

 var old = $.fn.ekkoLightbox;
  $.fn.ekkoLightbox = function(options) {

Then add a noConflict function for the case where a conflict occurs.

  $.fn.ekkoLightbox.Constructor = EkkoLightbox;

    // MODAL DATA-API
    // ==============
  $(document).on('click.bs.ekkoLightbox.data-api', '[data-toggle="lightbox"]', function (e) {
      event.preventDefault();
      $(this).ekkoLightbox();
  });

    // MODAL NO CONFLICT
    // =================

  $.fn.ekkoLightbox.noConflict = function () {
      $.fn.ekkoLightbox = old;
      return this;
  }

This makes implementation of the plugin consistent with other plugins. Don't you agree?

@midzer
Copy link

midzer commented Dec 7, 2016

There is a PR for this issue #178

@ashleydw
Copy link
Owner

ashleydw commented Dec 7, 2016

the automatic binding wasn't added as it would be a breaking change from current system where manual instantiation is required

noConflict concern has been addressed in latest version 5 for BS4

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants