Javascript 将分页添加到我的旋转木马(jQuery)

Javascript 将分页添加到我的旋转木马(jQuery),javascript,jquery,html,css,Javascript,Jquery,Html,Css,我正在尝试向旋转木马添加一个简单的指示器。目前,指标的数量不必动态生成。我正在尝试复制主页上的旋转木马 BBC网站上的指示器是右上角的橙色圆点。 我不想让这些点成为相应幻灯片的链接,我只想让这些点根据您单击“上一页”或“下一页”的情况循环 例如:(o=指示器) 欧欧欧 My JSFIDLE:请参阅更新的小提琴: 谢谢,我真的很感激 <prev [IMGS] next> o o o $(document).ready(function()

我正在尝试向旋转木马添加一个简单的指示器。目前,指标的数量不必动态生成。我正在尝试复制主页上的旋转木马

BBC网站上的指示器是右上角的橙色圆点。 我不想让这些点成为相应幻灯片的链接,我只想让这些点根据您单击“上一页”或“下一页”的情况循环

例如:(o=指示器)


欧欧欧
My JSFIDLE:

请参阅更新的小提琴:


谢谢,我真的很感激
<prev      [IMGS]      next>
           o o o
$(document).ready(function() {

//rotation speed and timer
var speed = 5000;
var run = setInterval('rotate()', speed);

//calculate width dynamically for responsive design
var starting_width = $('#slides ul li').width($('#slides').outerWidth());

//grab the width and calculate left value
var item_width = $('#slides ul li').outerWidth();
var left_value = item_width * (-1);

//move the last item before first item, just in case user click prev button
$('#slides ul li:first').before($('#slides ul li:last'));

//set the default item to the correct position 
$('#slides ul').css({
    'left': left_value
});

//if user clicked on prev button
$('#prev').click(function() {

    //get the right position            
    var left_indent = parseInt($('#slides ul').css('left')) + item_width;

    //slide the item            
    $('#slides ul:not(:animated)').animate({
        'left': left_indent
    }, 200, function() {

        //move the last item and put it as first item                
        $('#slides ul li:first').before($('#slides ul li:last'));

        //set the default item to correct position
        $('#slides ul').css({
            'left': left_value
        });

    });
    if ($('#pagination li span.current').parent().is(':first-child')) {
        $('#pagination li span.current').removeClass('current');
      $('#pagination li:last-child').children().addClass('current');
    } else {
    $('#pagination li span.current').parent().prev().children().addClass('current').addClass('new');
    $('#pagination li span.current').removeClass('current');
    $('#pagination li span.new').addClass('current').removeClass('new');
}
    //cancel the link behavior            
    return false;

});


//if user clicked on next button
$('#next').click(function() {

    //get the right position
    var left_indent = parseInt($('#slides ul').css('left')) - item_width;

    //slide the item
    $('#slides ul:not(:animated)').animate({
        'left': left_indent
    }, 200, function() {

        //move the first item and put it as last item
        $('#slides ul li:last').after($('#slides ul li:first'));

        //set the default item to correct position
        $('#slides ul').css({
            'left': left_value
        });

    });

    //change the itemlist class
    if ($('#pagination li span.current').parent().is(':last-child')) {
        $('#pagination li span.current').removeClass('current');
      $('#pagination li:first-child').children().addClass('current');
    } else {
        $('#pagination li span.current').parent().next().children().addClass('current').addClass('new');
        $('#pagination li span.current').removeClass('current');
        $('#pagination li span.new').addClass('current').removeClass('new');
    }
    //cancel the link behavior
    return false;

});

//if mouse hover, pause the auto rotation, otherwise rotate it
$('#slides').hover(

function() {
    clearInterval(run);
}, function() {
    run = setInterval('rotate()', speed);
});

});

//function to click next link
//a timer will call this function, and the rotation will begin :)  


function rotate() {
$('#next').click();
}​