开发者

jQuery slider widget background -- change dynamicaly

I use a custom background for my slider by overriding the CSS:

.ui-widget-content {background: transparent url(../img/bg.png) no-repeat;}

Slider's behavior is controlled by:

$(document).ready(function() {
    $(".myslider5").slider({
        animate: "true",
        step: 1,
        min: -1950,
        max: 1950,
        value: 0,
        slide: function(event, ui) {
               // magic happens here
        }
    });
    $(".myslider3").slider({
        animate: "true",
        step: 1,
        min: -1350,
        max: 1350,
        value: 0,
        slide: function(event, ui) {
               // magic happens here
        }
    });

So, myslider5 and myslider3 are the two classes. But their background images need to be different. How do I go about doing th开发者_C百科is?


UPDATED:

DEMO http://jsbin.com/itivu3

SOURCE http://jsbin.com/itivu3/edit

NOTE: taking in mind what you have asked, change image dynamically on slide!!!


I figured it out. For some reason, aSeptik's suggestion was not working. It had to be tweaked in the CSS section and not in the JS.

.myslider5.ui-widget-content {background: transparent url(../img/slider5.png);}
.myslider3.ui-widget-content {background: transparent url(../img/slider3.png);}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜