开发者

Anything Slider: How to use the .cur (class) when slide jump is activated?

开发者 https://www.devze.com 2022-12-18 19:21 出处:网络
Does anyone know how to make AnythingSlider use the .cur class when using static links to jump betwee开发者_如何学编程n slides?

Does anyone know how to make AnythingSlider use the .cur class when using static links to jump betwee开发者_如何学编程n slides?

I've got my the slider working great with the static links, but I'd like to highlight the current active link.

Cheers

Stephen Meehan


This is the solution I came up with. My tags have id's like 'slide-jump1' so I created a new variable called currentPageNow that creates a selector based that combines #slid-jump with the variable base.currentPage. I then add the 'cur' class based on that variable and remove it from the current one. You'll need to add class='cur' to your initial link to begin with. Hope this helps, sorry it's a bit disorganized but I'm in a hurry today.

    base.setCurrentPage = function(page, move){

        // Only change left if move does not equal false
        if(move !== false) base.$wrapper.scrollLeft(base.singleWidth * page);

        // Update local variable
        base.currentPage = page;

        $('#SliderNav a.cur').removeClass('cur');

        var currentPageNow = '#slide-jump' + base.currentPage;

        $(currentPageNow).addClass('cur');

    };
0

精彩评论

暂无评论...
验证码 换一张
取 消