【问题标题】:My image slider has white spaces我的图像滑块有空格
【发布时间】:2011-12-13 18:06:17
【问题描述】:

请看以下链接, http://www.beta.storeji.in/ 当图像滑动时,下一个图像不会滑动,直到滑动完成并且显示空白而不是图像。如何解决这个问题?

这是我的滑块 javascript 代码

function slide()
{
    if($('.current').is(':last-child')){
        $('.current').removeClass('current');
        $('#imgholder img:first-child').addClass('current');
        $('#imgholder').animate({left: '0px'});
    }
    else{
        $('.current').removeClass(function(){
            $(this).next().addClass('current');
            return 'current';
        });
        $('#imgholder').animate({left: '-=980'},{duration: 'slow', easing: 'easeOutBounce' });
        }
}
var loop_handle= setInterval("slide()",'5000');

【问题讨论】:

  • 尝试制作左边:'-=980" left:'=-980"
  • @albert,我不反对有人学习新东西,但也许 OP 只是没有意识到这个轮子已经被发明了。
  • 我发现创建自己的库比为我的模块使用库更容易

标签: javascript css image slider


【解决方案1】:

您的 picslider.css 工作表有错误,宽度和高度设置不正确;

#imgholder{
    position: absolute;
    width: 5880;
    height: 490;
    z-index: 0;
}

修复它,它应该可以正常工作。

已修复。

#imgholder{
    position: absolute;
    width: 5880px;
    height: 490px;
    z-index: 0;
}

【讨论】: