Mar*_*o C 4 ajax jquery image-rotation fadeout fadein
我有jQuery fadeIn(或fadeOut)方法的问题.我建立一个文章旋转器,一切正常,但是当页面滚动到底部并且文章旋转时出现问题,fadeIn(或fadeOut)方法导致滚动到文章位置.我认为这些方法,改变了身体的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;
}
Run Code Online (Sandbox Code Playgroud)
好的网站http://kario91.altervista.org/ultimate文本来自joomla这是完整的网站!变量工作正常,没有问题.尝试减少浏览器窗口并滚动底部
我很想说这个问题是因为当你的文章完全淡出时,就在调用回调之前,页面的高度会降低(因为文章是隐藏的),因此,浏览器滚动直到页面底部(没有文章)就在浏览器窗口的底部.尝试在fadeOut完成后删除回调,您可能会注意到浏览器如何对齐底部.
我认为你可以通过在fadeOut生物之前给文章容器一个高度来解决这个问题,当fadeOut完成后,在fadeIn开始之后立即删除这个高度......或类似的东西.
我希望这有帮助!
| 归档时间: |
|
| 查看次数: |
3999 次 |
| 最近记录: |