开发者

jQuery slider with marker to indicate split

开发者 https://www.devze.com 2023-04-01 22:22 出处:网络
I\'m trying to build a slider in jquery as shown in the image below. As a user slides the slider, the values on the marker are updated t开发者_JAVA技巧o indicate the position of the slider in percenta

I'm trying to build a slider in jquery as shown in the image below. As a user slides the slider, the values on the marker are updated t开发者_JAVA技巧o indicate the position of the slider in percentage. The slider is now at the 20%/80% mark. The 20% area has a darker color that increases as the user slides the slider to the right and decreases as the user slides to the left.

Here is what I've managed so far. http://dl.dropbox.com/u/1805626/splitter.html

Appreciate any help.


Add this bind:

$('#splitter').bind('drag',function(){
    $('#split-amount').css('width', $(this).position().left +Math.floor($(this).width() / 2) + 'px');
});

And add this CSS:

#split-amount {background-color: #333; height:80px; width:0;}

DEMO: http://jsfiddle.net/AlienWebguy/7mWw7/

0

精彩评论

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

关注公众号