I want the Swipebox to open the page with an image.
I did so:
jQuery
if($('.swipebox')[0]){
$('.swipebox')[0].click();
}
// Swipe Box
$('.swipebox').on('click', function(e) {
e.preventDefault();
$.swipebox([
{ href: urlBase + '/imagem.jpg', title:'Safe' }
]);
});
HTML
<a href="#" class="swipebox"></a>
Instead of opening Swipebox with the image, it opens on another page. But if I go to Chrome Console and type:
$('.swipebox').click();
, opens right.
Debug
I did this on and off!
$('#open-swipebox').click();
$('#open-swipebox').click(function (){
console.log('das');
});
<a href="#" id="open-swipebox"></a>