ページのニュースセクションにニュースティッカーを使用していて、これらのニュースでprettyphotoプラグインを使用したいのですが、<li>アイテムの位置が変わると、jquery関数が機能しません。
たとえば、最初のアイテムが最後になると、jquery関数は機能しません
これがコードです
$(document).ready(function(){
var first = 0;
var speed = 1000;
var pause = 3500;
function removeFirst(){
first = $('ul#listticker li:first').html();
$('ul#listticker li:first')
.animate({opacity: 0}, speed)
.fadeOut('slow', function() {$(this).remove();});
addLast(first);
}
function addLast(first){
last = '<li style="display:none">'+first+'</li>';
$('ul#listticker').append(last)
$('ul#listticker li:last')
.animate({opacity: 1}, speed)
.fadeIn('slow')
}
interval = setInterval(removeFirst, pause);
//Codes above are for the news ticker
$(".news").click(function(e){
e.preventDefault(); //I assign news class to links if there is no image for the news on db but it doesn't even work
});
$("#newsdiv a[rel^='gallery']").prettyPhoto({
theme:'light_rounded'
});
});
そして、php関数のHTML結果
<ul id="listticker">
<li>
<img src="http://example.com/m.../k_haber.png"><a href="#" class="news">12.05.2011</a><span class="news-text">Some Title</span>
</li>
<li>
<img src="http://example.com/../some.png"><a href="http://example.com/../news/p_some.jpg" class="news-title" rel="gallery[dd0]"> 12.05.2011</a><span class="news-text">Some Other Title</span>
</li>
</ul>
これを引き起こしている可能性があるもの、またはそれを修正する方法について何か考えはありますか?
編集:
問題はjqueryhtmlセレクターが原因で発生すると思います。