Skip to content

Commit

Permalink
Fix a few bugs
Browse files Browse the repository at this point in the history
ln 9+92
options.object was missing scope.

ln 29+35
amount of pips being created with stepped sliders was erroneous

ln 142
needed to change to .html() to accomadate html characters like: °
  • Loading branch information
simeydotme committed Jun 20, 2013
1 parent 2ce9488 commit fda25f8
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/js/jquery-ui-slider-pips.js
Expand Up @@ -6,7 +6,7 @@

pips: function( settings ) {

options = {
var options = {

first: "label", // "pip" , false
last: "label", // "pip" , false
Expand All @@ -19,20 +19,20 @@

$.extend( options, settings );

// labels are needed globally potentially.
// labels are needed globally, potentially.
this.options.labels = options.labels

// get rid of all pips that might already exist.
this.element.addClass('ui-slider-pips').find( '.ui-slider-pip' ).remove();

// we need the amount of pips to create.
var pips = this.options.max - this.options.min;
var pips = ( this.options.max - this.options.min ) / this.options.step;

This comment has been minimized.

Copy link
@simeydotme

simeydotme Aug 28, 2013

Author Owner

this never took into account if a step was more than 1 pip at a time


// for every stop in the slider; we create a pip.
for( i=0; i<=pips; i++ ) {

// create the label name, it's either the item in the array, or a number.
var label = (this.options.labels) ? this.options.labels[i] : (this.options.min+i);
var label = (this.options.labels) ? this.options.labels[i] : ( this.options.min + ( this.options.step * i ) );
if( typeof(label) === "undefined" ) { label = ""; }


Expand Down Expand Up @@ -89,7 +89,7 @@

float: function( settings ) {

options = {
var options = {
handle: true, // false
labels: true, // false
prefix: "", // "", string
Expand Down Expand Up @@ -139,8 +139,8 @@
}

// when slider changes, update handle tip label.
this.element.on('slidechange slide', function(e,ui) {
$(ui.handle).find('.ui-slider-tip').text( options.prefix + ui.value + options.suffix );
this.element.on('slidechange slide', function( e, ui ) {
$(ui.handle).find('.ui-slider-tip').html( options.prefix + ui.value + options.suffix );
});


Expand Down

0 comments on commit fda25f8

Please sign in to comment.