2
votes

Using BxSlider jQuery content slider for a project (http://bxslider.com/). I'm using the "reloadShow() function on window resize so that the content is re-aligned to the center.

The reloadShow() function is working but it resets my slide to the first one each time. Instead I'd like to remember the slide it's on and reload to that slide.

Here is my 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();
    });

});
Maybe the answer from this link will help you: stackoverflow.com/questions/30342705/… Good luck! - ElaAle