jQueryのfadeIn(またはfadeOut)メソッドに問題があります。アーティクルローテーターを作成しましたが、すべて正常に機能しますが、ページを下にスクロールしてアーティクルを回転させると問題が発生します。fadeIn(またはfadeOut)メソッドを使用すると、アーティクルの位置にスクロールします。これらのメソッドは、bodyのcss topプロパティを変更すると思いますが、これを回避する方法がわかりません。何か案が???
ここにコード
function rotate(direction)
{
if($('articles > article:visible:first') == 'undefined')
$currentArticle = $('articles > article:first');
else
$currentArticle = $('articles > article:visible:first');
if($currentArticle.attr('id') == $('articles > article:last').attr('id'))
$next = $('articles > article:first');
else
$next = $currentArticle.next();
if($currentArticle.attr('id') == $('articles > article:first').attr('id'))
$prev = $('articles > article:last');
else
$prev = $currentArticle.prev();
if($do_animation)
{
$currentArticle.fadeOut(1000,function(){
switch(direction)
{
case 1:
$next.fadeIn(1000);
break;
case -1:
$prev.fadeIn(1000);
break;
}
if($('.rotate_show'))
$('.rotate_show').removeClass('rotate_show');
$('article_number > btn[id|="'+$next.attr('id')+'"]').addClass('rotate_show');
});
}
else
return false;
}
わかりました、サイトhttp://kario91.altervista.org/ultimateテキストはjoomlaからのものですこれは完全なサイトです!変数は正常に機能します。問題はありません。ブラウザウィンドウを縮小して、下にスクロールしてみてください。