Permalink
Browse files

Rangeslider: added new event beforechange to slider which we return f…

…alse on when we want to eat the change event in rangeslider
  • Loading branch information...
1 parent 89238c2 commit c7585eb0a72ea9ce2fb469974b413423db1770b6 Alexander Schmitz committed Dec 21, 2012
Showing with 9 additions and 1 deletion.
  1. +5 −1 js/widgets/forms/rangeslider.js
  2. +4 −0 js/widgets/forms/slider.js
@@ -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"
});
@@ -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() {
@@ -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" );
+
}
}
},

0 comments on commit c7585eb

Please sign in to comment.