I noticed that the code in the mouseup for the toggle switch was using a CSS3 transition, but calling the animationComplete() function which waits for an animationend event which will never come. This means we bind a new animationComplete() handler every time the toggle switch is clicked.

I removed the binding for the handler completely since it doesn't hurt to just leave the transition in place. I also removed the code that was setting the position of the slider since it really should only be set within the mouseup if the user did not change the switch setting (toggle).
This commit is contained in:
Kin Blas 2011-09-01 15:42:30 -07:00
parent a27f7d355f
commit 7bf048a214

View file

@ -140,16 +140,9 @@ $.widget( "mobile.slider", $.mobile.widget, {
if ( !self.userModified ) {
//tap occurred, but value didn't change. flip it!
handle.addClass( "ui-slider-handle-snapping" );
self.refresh( !self.beforeStart ? 1 : 0 );
}
var curval = val();
var snapped = Math.round( curval / ( max - min ) * 100 );
handle
.addClass( "ui-slider-handle-snapping" )
.css( "left", snapped + "%" )
.animationComplete( function() {
handle.removeClass( "ui-slider-handle-snapping" );
});
}
return false;
}