You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The fix made for jQuery 3.x was this to forcefully add a swipebox class to the calling element, and then to have the selector variable use that class. While this works fine in some cases, in other cases it causes quite a lot of problems.
In my use case, there are multiple types of galleries on the same page, each with different settings. When you are setting the selector to be universally .swipebox, the binding is getting messy, and the settings of one gallery tend to overlap with another. E.g. I have different functions for the beforeOpen and afterOpen events based on the selectors, but the one defined last is overriding all the others. This is problematic, since it tends to result in errors if certain conditions that would be met for one selector don't apply to the others.
I would propose a hybrid - you can add the option for the selector, then, in your plugin.init function, use the option if not null. If null, then use the default .swipebox that you added to all elements. This way, users will not have to change their code, and you will be able to fix the bug too.
The text was updated successfully, but these errors were encountered:
The fix made for jQuery 3.x was this to forcefully add a
swipebox
class to the calling element, and then to have the selector variable use that class. While this works fine in some cases, in other cases it causes quite a lot of problems.In my use case, there are multiple types of galleries on the same page, each with different settings. When you are setting the
selector
to be universally.swipebox
, the binding is getting messy, and the settings of one gallery tend to overlap with another. E.g. I have different functions for thebeforeOpen
andafterOpen
events based on the selectors, but the one defined last is overriding all the others. This is problematic, since it tends to result in errors if certain conditions that would be met for one selector don't apply to the others.I believe you might want to consider an alternative to hardcoding the selector to
.swipebox
. The implementation here lets you define a setting calledselector
, and then use that setting: https://github.com/mho79/swipebox/blob/master/src/js/jquery.swipebox.js.I would propose a hybrid - you can add the option for the
selector
, then, in yourplugin.init
function, use the option if notnull
. Ifnull
, then use the default.swipebox
that you added to all elements. This way, users will not have to change their code, and you will be able to fix the bug too.The text was updated successfully, but these errors were encountered: