Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
Rangeslider: added new event beforechange to slider which we return f…
Browse files Browse the repository at this point in the history
…alse on when we want to eat the change event in rangeslider
  • Loading branch information
Alexander Schmitz committed Dec 21, 2012
1 parent 89238c2 commit c7585eb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion js/widgets/forms/rangeslider.js
Expand Up @@ -61,7 +61,7 @@ define( [ "jquery", "../../jquery.mobile.core", "../../jquery.mobile.widget", ".
"slidebeforestart": "_slidebeforestart",
"slidestop": "_slidestop",
"slidedrag": "_slidedrag",
"change": "_change",
"slidebeforechange": "_change",
"blur": "_change",
"keyup": "_change"
});
Expand Down Expand Up @@ -156,11 +156,15 @@ define( [ "jquery", "../../jquery.mobile.core", "../../jquery.mobile.widget", ".
if( min === max ) {
thisSlider.data( "mobileSlider" ).handle.css( "z-index", 1 );
otherSlider.data( "mobileSlider" ).handle.css( "z-index", 0 );

} else {
otherSlider.data( "mobileSlider" ).handle.css( "z-index", "" );
thisSlider.data( "mobileSlider" ).handle.css( "z-index", "" );
}
this._updateHighlight();
if(min >= max){
return false;
}
},

_updateHighlight: function() {
Expand Down
4 changes: 4 additions & 0 deletions js/widgets/forms/slider.js
Expand Up @@ -483,7 +483,11 @@ $.widget( "mobile.slider", $.mobile.widget, {
control[ 0 ].selectedIndex = newval;
}
if ( !isfromControl && valueChanged ) {
if ( this._trigger( "beforechange", event ) === false) {
return false;
}
control.trigger( "change" );

}
}
},
Expand Down

0 comments on commit c7585eb

Please sign in to comment.