Reputation: 1301
Help is more than needed. I just dont know where to dig! Suddenly click event started to fire twice(worked well before). I cannot identify the source of this problem.
Can anyone help?
I'm working on photographer website built on wordpress. Here is testing website - http://kick-starter.co.il/pregnancy?lang=en&pag=1
This is javascript http://kick-starter.co.il/wp-content/themes/twentyeleven/js/javascript.js This it my buttons -
$('#right').click(function(){ //click right to change page
if ( page < pages ){
page++;
change_pics( page, album );
sethash( page, '' );
}
})
$('#left').click(function(){ //click left to change page
if ( page > 1 ){
page--;
change_pics( page, album );
sethash( page, '' );
}
})
Thanks a lot.
Upvotes: 1
Views: 150
Reputation: 3986
You can try using preventDefault() and stopPropagation() to prevent multiple event occurrence.
$('#right').click(function(e){ //click right to change page
e.stopPropagation();
e.preventDefault();
if ( page < pages ){
page++;
change_pics( page, album );
sethash( page, '' );
}
})
$('#left').click(function(e){ //click left to change page
e.stopPropagation();
e.preventDefault();
if ( page > 1 ){
page--;
change_pics( page, album );
sethash( page, '' );
}
})
Upvotes: 1