lightbox
lightbox copied to clipboard
Plugin is defined but does not automatically enable
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)
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.
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?
There is a PR for this issue https://github.com/ashleydw/lightbox/pull/178
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