Javascript onClick功能在移动设备上不起作用
我在左边有一个图像,在右边有几个图标。当有人点击图标时,左侧的图像将发生变化。 在台式机中工作,但在移动设备中不工作 这是我的代码,希望你能帮助我Javascript onClick功能在移动设备上不起作用,javascript,html,function,onclick,Javascript,Html,Function,Onclick,我在左边有一个图像,在右边有几个图标。当有人点击图标时,左侧的图像将发生变化。 在台式机中工作,但在移动设备中不工作 这是我的代码,希望你能帮助我 <div class="container container-amenidades-bloque2"> <div class="col-sm-6 img-amenidades" id="div1"> <img src="http://www.eqia.mx/wp-content/uploads/2018/
<div class="container container-amenidades-bloque2">
<div class="col-sm-6 img-amenidades" id="div1">
<img src="http://www.eqia.mx/wp-content/uploads/2018/06/amenidades.img-min.png"/>
</div>
<div class="col-sm-6 container-all-icons-amenidades">
<div class="container-icon-amenidades" onclick="gym()" id="icon-gym">
<img src="http://www.eqia.mx/wp-content/uploads/2018/06/iconohome-6.png">
<p>Gym</p>
</div>
<div class="container-icon-amenidades" onclick="spa()" id="icon-spa">
<img src="http://www.eqia.mx/wp-content/uploads/2018/06/iconohome-6.png">
<p>Spa</p>
</div>
</div>
</div>
<script>
function divPic() {
document.getElementById('div1').innerHTML = "<img src='https://upload.wikimedia.org/wikipedia/commons/2/2f/MRT_Singapore_Destination_1.png'>";
}
function gym() {
document.getElementById('div1').innerHTML = "<img src='https://upload.wikimedia.org/wikipedia/commons/1/10/MRT_Singapore_Destination_2.png'>";
}
function spa() {
document.getElementById('div1').innerHTML = "<img src='https://upload.wikimedia.org/wikipedia/commons/2/2f/MRT_Singapore_Destination_1.png'>";
}
</script>
健身房
温泉
函数divPic(){
document.getElementById('div1').innerHTML=“”;
}
功能健身房(){
document.getElementById('div1').innerHTML=“”;
}
函数spa(){
document.getElementById('div1').innerHTML=“”;
}
在document.ready函数中没有包含JavaScript代码
$(document).ready(function(){
Your_code_here
}
希望这能起作用jQuery并不是解决所有问题的解决方案,尤其是当它是一项可以用普通JavaScript轻松完成的任务时P