あなたのコードが何をしているかについて感謝します。最初の例では、次のことが起こります。
$('.next').live('click',function(){
$('#slideshow > div:first') //get first div, div1, in slideshow
.fadeOut(0) //fade div1 out
.next() //get the next div, div2
.fadeIn(1000) //fade div2 in
.end() //end
.appendTo('#slideshow'); //append the original div, div1, to the end of the show
}) ;
これに関する問題は、スライドショーに常に画像を追加していることです。これにより、非常に多くの DOM 要素が生成されます。まったく追加したくないと思います。
それにもかかわらず、コードは2番目のケースでは機能しません...
$('.prev').live('click',function(){
$('#slideshow > div:first') //get first div, div1
.fadeOut(0) //fade it out
.prev() //previous is nothing because you already have the first one! This is no doubt why it breaks
.fadeIn(1000)
.end()
.appendTo('#slideshow'); //again you are appending. Seems like a bad idea
}) ;
これを行う場合は、代わりにクラスを使用します。テストされていませんが、次のようになります。
<div id="slideshow">
<img.prev>
<img.next>
<div1 class="active">
<div2>
<div3>
</div>
$('.next').live('click',function(){
$('#slideshow > div.active') //get active div
.fadeOut(0) //fade out
.removeClass('active')
.next() //get the next div
.fadeIn(1000) //fade it in
.addClass('active'); //make new div the active one
}) ;
$('.next').live('click',function(){
$('#slideshow > div.active') //get active div
.fadeOut(0) //fade out
.removeClass('active')
.prev() //get the prev div
.fadeIn(1000) //fade it in
.addClass('active'); //make new div the active one
}) ;