Home >Web Front-end >HTML Tutorial >Click on the background image_html/css_WEB-ITnose
Use a small picture as a background. I want to monitor the click event of the small picture. How should I monitor it.
.libiao_menu{ background:url("images/1.gif") no-repeat 0 -41px;}
I just want to monitor the click event of this 1.gif image.
Simulation can be judged by coordinates
Is there no direct judgment? Please be more specific by judging by coordinate simulation, thank you.
Place a transparent label on the image, adjust the size to be the same as the image, and then listen to the click event of this label.
What does background image monitoring mean?
Isn’t it possible to monitor .libiao_menu?
Is there something else in .libiao_menu? Clicking on that will not punish the monitoring?
If this is the case, listen to .libiao_menu, then listen to other content in it, and then stop bubbling
Assume your picture is:
<img src='/test.jpg' id='test'/>
$(document).ready( function(){ $('#test').click( function(){ alert('this is a picture'); });});
window.onload=function(){ img1=document.getElementById('test'); img1.click=function(){ alert('This is a picture'); }}
$(.libiao_menu).click(function(){
alert('clicked');
});
The answer on the 5th floor