Reputation: 591
So, I saw this post which has this jsfiddles.
The answer was the following as below:
$('selector').featherlight() (or using data-featherlight) is for binding, like $('selector').click( function() {...} ).
$.featherlight(...) is for triggering, like $('selector').click()
So, bind on click and trigger, or bind via $('...').featherlight, but don't bind on click and then bind in that handler, like you're doing now.
I am having the same issue but I don't know how to bind on click and trigger
like the answer.
So, if this is the js code (original code) then how would you bind on click and trigger
?
jQuery('.something_else').click(function(e) {
jQuery('.something_else').featherlight({
targetAttr: 'data-single',
});
})
Upvotes: 2
Views: 177
Reputation: 32354
Try:
jQuery('.something_else').featherlight({
targetAttr: 'data-single',
});
jsfiddle:https://jsfiddle.net/5e9e2k6y/9/
Upvotes: 3