swipebox
swipebox copied to clipboard
jQuery 3.0 support?
With jQuery 3.0 a click anywhere on the page initializes an empty Swipebox that can't be closed again. Seems like a compatibility issue. Will Swipebox support jQuery 3.0?
same Error. Did you find a solution
Sorry, no.
I've found the cause of the problem: https://api.jquery.com/selector/ Doesn't look like a quick fix.
Any comment from the author, please?
last update is almost 4 month old. I think we should look for alternatives
hey there,
I didn't found a solution yet. I will update the plugin as soon as I got it. Any help here will be greatly appreciated.
My suggestion would be to specify the "selector" in the options and the user would initialise by targeting (e.g.) the body rather than the links, like $(body).swipebox({selector:'.swipebox'})
. This would only be for dynamic content, if you didn't need it to be dynamic you would just do it the normal way. This is how Bootstrap does it for things like popovers.
So rather than $( document ).on( 'click', selector, ...
it would be $( elem ).on( 'click', settings.selector, ...
.
And then instead of $elem = $( selector )
it would be $elem = $( elem ).find( settings.selector )
, or if selector wasn't specified it would just be $elem = $( elem )
.
[EDIT] To all readers looking for a fix, please ignore this post and see PR #298.
Hm, thanks for the work, but calling it with $(body).swipebox({selector:'.swipebox'})
as the user seems odd to me. Is this really the way to go?
Yes it is, but only if you're working with dynamic content where elements may be added on the fly and you don't want to reinitialise Swipebox. Otherwise just carry on doing it the normal way.
The jQuery migrate plugin reports bind/unbind as deprecated, so it may also be good to change all of these to on/off just to be safe.
Yes, but with jQuery 3.0, I cannot carry on. Any other solution ?
to make plugin works it is not enough to call plugin as described before $(".swipebox").swipebox({ selector: '. swipebox' }); you need to add one more line of code: around line #70 after plugin.settings = $.extend( {}, defaults, options ); add selector = plugin.settings.selector;
@zhaabbaa you need to apply the pull request referenced above (#298).
I can confirm that the PR in #298 works for me with jQuery 3.1.0 - thanks!
#298 works with jQuery 3.1.0. Thanks!
@brutaldesign Any news on this?
This fix works on jQuery 3.2.1 when called with the extra selector.
My old version still works fine, but when I updated to the new version, it gave me an error message. Every time I pressed start, it showed a black screen, and there was no way to close it. I'm applying it but it's still giving an error, do you have any specific description, or am I doing something wrong: { "version": "1.0", "defaultProvider": "cdnjs", "libraries": [
{
"provider": "cdnjs",
"library": "[email protected]",
"destination": "wwwroot/lib/jquery.swipebox/",
"files": [
"js/jquery.swipebox.min.js",
"js/jquery.swipebox.js"
]
},
{
"provider": "cdnjs",
"library": "[email protected]",
"destination": "wwwroot/lib/jquery.swipebox/"
},
{
"provider": "cdnjs",
"library": "[email protected]",
"destination": "wwwroot/lib/jqueryui/",
"files": [
"jquery-ui.min.js",
"themes/base/jquery-ui.css",
"themes/base/jquery-ui.min.css",
"jquery-ui.js"
]
},
{
"provider": "cdnjs",
"library": "[email protected]",
"destination": "wwwroot/lib/jquery/",
"files": [
"jquery.min.js",
"jquery.js"
]
}
]
}