我的网站上的图像滑块出现幻灯片问题

Slide issues with my image slider on my website

本文关键字:幻灯片 问题 网站 图像 我的      更新时间:2023-09-26

嘿,所以我遇到的问题在我的网站上 www.stallionstride.org.

当我的按钮被缓慢按下时,图像滑块会起作用,但是,如果你快速按下左右按钮,当我的图像应该向后滑动而不是滑动到空白处时。

尝试使用停止命令,但这对我不起作用。

这是我的代码。我只包含右按钮事件,因为左按钮基本相同。 任何帮助将不胜感激。

$('#rightbutton').click(function() {
    //clear the timer since photos scroll through at a certain amount of time
    clearTimeout(timeoutTracker);
    var scrollAmount = $('#slideshow_inner img').width();
    var currentPos = Math.abs(parseInt($('#slideshow_inner').css('left')));
    var remainingScroll = ($('#slideshow_inner').width() - currentPos)/908;
    if (remainingScroll == 1) {
        $('#slideshow_inner').stop(true, false).animate({ 'left' : '0' }, 'slow');
    }
    else {
        $('#slideshow_inner').stop(true, false).animate({ 'left' : '-=' + scrollAmount}, 'slow');
    }
    timeoutTracker = setTimeout(function() {$('#rightbutton').click(); }, 3000);
});

滑动图像需要更多的设计,尤其是使用后退/下一步按钮。

我建议使用开发良好的插件,而不是自己构建。

我能想到的一个是slidejs,http://www.slidesjs.com/