我有2个图像,他们都在同一个div。我已将一张图片的z-index
设置为-1,并使用margin-bottom
将其向下移动。Onclick事件不起作用jquery
这是我的代码:
<div data-role="page" id="Mycom" class="background">
<div data-role="header" class="header" data-position="fixed" data-tap-toggle="false"></div>
<div data-role="content">
<center>
<h2>Headlines</></h2>
<div> <a href="#" id="indrotate"><img src="Image/right.png" style="width:30%;z-index:-1;margin-bottom:-30% !important;margin-left:70% !important;" /></a>
<img src="SlicedImages/bground2.png" id="indimage" style="height:auto; max-height:80%; width:auto; max-width:90%;" />
</div>
</center>
<center> <a href="#" data-role="none" data-inline="true" data-transition="none"><img src="Image/Next.png" width="200px" height ="10%"></a>
</center>
</div>
</div>
<!-- ind Page end -->
,在我的js文件我有:
$(document).on('pagebeforeshow','#Mycom',function(e,data){
$('#indrotate').on('click',function(){
alert("indrotate");
});
});
什么错误,我在做什么?
你尝试过'pageshow'吗? – Satpal
你不需要将它绑定到页面事件。只要删除'pagebeforeshow'绑定。 – Omar