I use HTML, CSS, JavaScript in Rails. My images are stored in the Applications / Assets / Images folder. My sound (for the onClick event listener) is stored in my public / audio folder.
I'm looking for layer images on top of each other, so I can target every single image to set different JavaScript onClick event listeners, but do these images render with an invisible background? which prevents clicks on the images that it overlays.
In offline mode, my gifs have no background. A selection of icons without a background for reference: http://findicons.com/search/gif
To emphasize that there is an invisible background for the image,
the bottom icon, this is the icon highlighted by clicking on the background of the icon (it is highlighted) also triggers an onClick JavaScript event listener
I use the rails command to render the image on my page.
<div id="id3"> <%= image_tag "gif_file.png" %> </div>
My css targeting a div
#id3 { position:absolute; }
To reduce the amount of text and confusion, I leave a code that shows overlapping icons.
My .js file
var soundright = '<audio autoplay="autoplay" src="/audios/hello.wav"></audio>' var sound = document.getElementById('sound'); var icon = document.getElementById('id3'); $(icon).click(function(){ $(sound).html(soundright); });
Please let me know how I can click on each rendered image that overlays noticeably (JavaScript onClick event listeners are added to each individual image) without clicking on the invisible background of the image that overlays on top of it.
Eliminating an invisible background is a solution that I could not find.
I try to make a target by superimposing images on each other and doing every part of the mouse click (onClick).
EDIT: just changed my last 3 paragraphs to make it easier to understand