mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-03-16 22:10:25 +00:00
Convert checkbox/radio and navbar over to virtual mouse events.
This commit is contained in:
parent
2381bfdeef
commit
6414e35cee
2 changed files with 12 additions and 26 deletions
|
|
@ -37,55 +37,41 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
|
|||
.wrapAll( "<div class='ui-" + inputtype +"'></div>" );
|
||||
|
||||
label.bind({
|
||||
mouseover: function() {
|
||||
vmouseover: function() {
|
||||
if( $(this).parent().is('.ui-disabled') ){ return false; }
|
||||
},
|
||||
|
||||
"touchmove": function( event ){
|
||||
var oe = event.originalEvent.touches[0];
|
||||
if( label.data("movestart") ){
|
||||
if( Math.abs( label.data("movestart")[0] - oe.pageX ) > 10 ||
|
||||
Math.abs( label.data("movestart")[1] - oe.pageY ) > 10 ){
|
||||
label.data("moved", true);
|
||||
}
|
||||
}
|
||||
else{
|
||||
label.data("movestart", [ parseFloat( oe.pageX ), parseFloat( oe.pageY ) ]);
|
||||
}
|
||||
vmousecancel: function( event ){
|
||||
label.data("moved", true);
|
||||
},
|
||||
|
||||
"touchend mouseup": function( event ){
|
||||
vmouseup: function( event ){
|
||||
if ( input.is( ":disabled" ) ){
|
||||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
|
||||
label.removeData("movestart");
|
||||
if( label.data("etype") && label.data("etype") !== event.type || label.data("moved") ){
|
||||
label.removeData("etype").removeData("moved");
|
||||
if( label.data("moved") ){
|
||||
label.removeData("moved");
|
||||
}
|
||||
|
||||
if( label.data("moved") ){
|
||||
label.removeData("moved");
|
||||
return false;
|
||||
}
|
||||
label.data( "etype", event.type );
|
||||
self._cacheVals();
|
||||
input.attr( "checked", inputtype === "radio" && true || !input.is( ":checked" ) );
|
||||
self._updateAll();
|
||||
event.preventDefault();
|
||||
},
|
||||
|
||||
click: false
|
||||
vclick: false
|
||||
|
||||
});
|
||||
|
||||
input
|
||||
.bind({
|
||||
mousedown: function(){
|
||||
vmousedown: function(){
|
||||
this._cacheVals();
|
||||
},
|
||||
|
||||
click: function(){
|
||||
vclick: function(){
|
||||
self._updateAll();
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -32,10 +32,10 @@ $.widget( "mobile.navbar", $.mobile.widget, {
|
|||
iconpos: iconpos
|
||||
});
|
||||
|
||||
$navbar.delegate("a", "click",function(event){
|
||||
$navbar.delegate("a", "vclick",function(event){
|
||||
$navbtns.removeClass( "ui-btn-active" );
|
||||
$( this ).addClass( "ui-btn-active" );
|
||||
});
|
||||
}
|
||||
});
|
||||
})( jQuery );
|
||||
})( jQuery );
|
||||
|
|
|
|||
Loading…
Reference in a new issue