0
我已經使用了2個錨點標籤(#trendingnexticon和#trendingpreviousicon)來移動 容器的內容,當我點擊標籤時內容完全向右或向左移動但它只能移動一次。當我再次點擊時,它不會移動!有什麼建議麼?JQuery-animate()只能在點擊時工作一次
的Javascript:
$(document).ready(function(){
$("#trendingnexticon").on('click' ,function(){
$("#trendingtable").animate({right: '800px'});
});
});
$(document).ready(function(){
$("#trendingpreviousicon").on('click' ,function(){
$("#trendingtable").animate({left: '100px'});
});
});
HTML:
<div id="trendingdiv" class="" style="overflow-x:scroll; overflow:
hidden;">
<table id="trendingtable" class="table" style="position:relative;">
<a id="trendingpreviousicon" style="cursor:pointer; margin-top:
62px; position:absolute; z-index:1;" class="previous round">‹</a>
<a id="trendingnexticon" style="cursor:pointer; margin-left: 1250px;
margin-top: 62px; position:absolute; z-index:1;" class="next
round">›</a>
<tr>
<?php while ($tsingers = mysqli_fetch_assoc($tsingersquery)): ?>
<td>
<div class="media" style="border: 1px solid #e6e6e6;
width:400px; padding: 0px;">
<img src="images/<?=$tsingers['image'];?>" alt="<?
=$tsingers['name'];?>"
class="pull-left img-responsive" style="width: 200px; height:
150px;" id="artistimg">
<div id="trendingmediabody" class="media-body">
<p id="trendingname" style="font-size:14px; font-weight:
bolder;"><?=$tsingers['name'];?></p>
<p id="trendingcategory" style="font-size:12px; font-weight:
bolder;"><?=$tsingers['category'];?></p></br></br>
</div>
</div>
</td>
<?php endwhile; ?>
</tr>
</table>
</div>
謝謝!它現在可以工作了。但是我遇到了一個新問題。如果我點擊左側的圖標一次,然後點擊右側的圖標不起作用。右側圖標變爲「禁用」一旦左側圖標被點擊,是否有東西丟失? – 2chins