我有以下代码。我的问题是,当我单击 div maya 时,jquery 无法识别它,它不会给我警报。
CSS
<style>
#carousel-single-image {
width: 320px;
height: 400px;
margin: 0 auto;
background: white;
}
#carousel-single-image .touchcarousel-container {
height: 100%;
background: url("../touchcarousel/demo-images/wood-pattern.jpg") repeat;
}
#carousel-single-image .touchcarousel-item {
margin-right: 0;
width: 400px;
height: 400px;
}
#carousel-single-image img {
width: 300px;
height: 360px;
margin: 32px 0 0 8px;
float:left;
position: relative;
display: block;
padding: 3px;
background: transparent;
border: 0;
-webkit-box-shadow: 0 1px 6px rgba(0,0,0,0.6);
-moz-box-shadow: 0 1px 6px rgba(0,0,0,0.6);
box-shadow: 0 1px 6px rgba(0,0,0,0.6);
}
#carousel-single-image .tc-paging-container {
margin-top: -380px;
}
</style>
HTML
<div id="productGallery" style="display:none">
<div id="main-body">
<div id="carousel-single-image" class="touchcarousel minimal-light">
<ul class="touchcarousel-container">
<li class="touchcarousel-item">
<a href="#"> <img data-original="/image1.jpg" />
<span class="maya">CheckClick</span></a>
</li>
<li class="touchcarousel-item">
<a href="#"> <img data-original="/image2.jpg" />
<span class="maya">CheckClick</span></a>
</li>
</ul>
</div>
</div>
</div>
脚本
$('.maya').click(function(){
alert("hi");
});