1
I want you to open the page and open a Swipebox with an image.
http://brutaldesign.github.io/swipebox/#Try
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 him opening Swipebox with the image, open it on another page. But if I go to the Chrome Console and type:
$('.swipebox').click();
, opens right.
Debug
I did it here and it doesn’t work !
$('#open-swipebox').click();
$('#open-swipebox').click(function (){
console.log('das');
});
<a href="#" id="open-swipebox"></a>
You want when you open the page, automatically from a Trigger on your link?
– Pedro Camara Junior
Exactly. A
trigger
. But I tried and it didn’t work.– Diego Souza