diff --git a/src/js/jquery-ui-slider-pips.js b/src/js/jquery-ui-slider-pips.js
index 09da152..9339326 100644
--- a/src/js/jquery-ui-slider-pips.js
+++ b/src/js/jquery-ui-slider-pips.js
@@ -1,5 +1,3 @@
-/* jquery slider pips plugin, version 1.1 */
-
(function($) {
var extensionMethods = {
@@ -23,8 +21,14 @@
prefix: "",
// "", string
- suffix: ""
+ suffix: "",
// "", string
+
+ formatLabel: function(value) {
+ return options.prefix + value + options.suffix;
+ }
+ // function
+ // must return a value to display in the pip labels
};
@@ -43,7 +47,6 @@
// for every stop in the slider; we create a pip.
for( var i=0; i<=pips; i++ ) {
-
// create the label name, it's either the item in the array, or a number.
var label;
@@ -58,12 +61,11 @@
label = "";
}
-
// hold a span element for the pip
var pipHtml =
""+
""+
- ""+ options.prefix + label + options.suffix +""+
+ ""+ options.formatLabel(label) +""+
"";
var $pip = $(pipHtml);
@@ -90,7 +92,6 @@
}
-
// if it's a horizontal slider we'll set the left offset,
// and the top if it's vertical.
if( slider.options.orientation === "horizontal" ) {
@@ -103,7 +104,6 @@
}
-
// append the span to the slider.
slider.element.append( $pip );
@@ -116,12 +116,10 @@
$.extend(true, $["ui"]["slider"].prototype, extensionMethods);
-
})(jQuery);
-
-/* jquery slider float plugin, version 1.1 */
+
(function($) {
@@ -143,9 +141,15 @@
prefix: "",
// "", string
- suffix: ""
+ suffix: "",
// "", string
+ formatLabel: function(value) {
+ return options.prefix + value + options.suffix;
+ }
+ // function
+ // must return a value to display in the floats
+
};
$.extend( options, settings );
@@ -199,8 +203,8 @@
}
$tip = [
- $(""+ options.prefix + vals[0] + options.suffix +""),
- $(""+ options.prefix + vals[1] + options.suffix +"")
+ $(""+ options.formatLabel(vals[0]) +""),
+ $(""+ options.formatLabel(vals[1]) +"")
];
// else if its just a normal slider
@@ -223,7 +227,7 @@
// create a tip element
- $tip = $(""+ options.prefix + val + options.suffix +"");
+ $tip = $(""+ options.formatLabel(val) +"");
}
@@ -266,7 +270,7 @@
}
- $(ui.handle).find(".ui-slider-tip").html( options.prefix + val + options.suffix );
+ $(ui.handle).find(".ui-slider-tip").html( options.formatLabel(val) );
});
@@ -279,19 +283,4 @@
$.extend(true, $["ui"]["slider"].prototype, extensionMethods);
- })(jQuery);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ })(jQuery);
\ No newline at end of file