Reputation: 1856
I have a short question.
I'm using the FooBox plugin on my Wordpress site, accompanied by FooGallery. Now I want to add a little tweak with javascript.
When I click on an image, the FooBox will show up, with arrows to the left and right. I want to add the same functionality to the image itself, so when you click the left side of the image it will go back in gallery, and if you click the right, it will go to the next image.
I've already know the answer in jQuery, but now i need a pure JS solution. Thanks in advice!
Upvotes: 0
Views: 36
Reputation: 9583
When you have the element using
var elem = document.getElementById('yourId')
or
var elem = document.getElementsByClassName('yourClass')[0]
or whatever
you may then add a handler to the onclick
event
eg
elem.onclick = function(e){
console.log(e)
}
log:
click clientX=480, clientY=63
Upvotes: 1