Line | |
---|
1 | jQuery(function($){ |
---|
2 | |
---|
3 | $('.range').each(function(){ |
---|
4 | var cls = $(this).attr('class'); |
---|
5 | var matches = cls.split(/([a-zA-Z]+)\-([0-9]+)/g); |
---|
6 | var elem = $(this).parent(); |
---|
7 | var options = {}; |
---|
8 | var input = elem.find('input'); |
---|
9 | elem.append('<div class="uirange"></div>'); |
---|
10 | |
---|
11 | for(i in matches){ |
---|
12 | i = i * 1; |
---|
13 | if(matches[i] == 'min'){ |
---|
14 | options.min = matches[i+1]*1; |
---|
15 | } |
---|
16 | if(matches[i] == 'max'){ |
---|
17 | options.max = matches[i+1]*1; |
---|
18 | } |
---|
19 | } |
---|
20 | |
---|
21 | options.slide = function(event, ui){ |
---|
22 | elem.find('label span').empty().append(ui.value); |
---|
23 | input.val(ui.value); |
---|
24 | } |
---|
25 | options.value = input.val(); |
---|
26 | options.range = 'min'; |
---|
27 | elem.find('.uirange').slider(options); |
---|
28 | |
---|
29 | elem.find('label span').empty().append(input.val()); |
---|
30 | input.hide(); |
---|
31 | }); |
---|
32 | |
---|
33 | }); |
---|
Note: See
TracBrowser
for help on using the repository browser.