jquery bxslider记得在窗口上调整大小reloadShow()函数

时间:2012-10-03 19:02:32

标签: jquery window-resize bxslider

为项目使用BxSlider jQuery内容滑块(http://bxslider.com/)。我在窗口调整大小时使用“reloadShow()函数,以便内容重新对齐到中心。”

reloadShow()函数正在运行但它每次都会将我的幻灯片重置为第一个。相反,我想记住它上面的幻灯片并重新加载到幻灯片中。

这是我的JS:

$(function(){
    // assign the slider to a variable
    slider = $('#slider').bxSlider(
    {
        controls: false,
        auto: false
    });

    // assign a click event to the external thumbnails
    $('.thumbs a').click(function()
    {
        var thumbIndex = $('.thumbs a').index(this);
        // call the "goToSlide" public function
        slider.goToSlide(thumbIndex);

        // remove all active classes
        $('.thumbs a').removeClass('pager-active');
        // assisgn "pager-active" to clicked thumb
        $(this).addClass('pager-active');
        // very important! you must kill the links default behavior
        return false;

    });

    // assign "pager-active" class to the first thumb
    $('.thumbs a:first').addClass('pager-active');

    $(window).resize(function(e)
    {
        slider.reloadShow();
    });

});

0 个答案:

没有答案
相关问题