mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-04-28 09:54:44 +00:00
Enable binding to scrollstop without scrollstart, taphold without tap and swipeleft/swiperight without swipe.
This commit is contained in:
parent
c529633ce1
commit
5cc3747bfc
1 changed files with 17 additions and 3 deletions
|
|
@ -19,10 +19,11 @@ $.event.special.scrollstart = {
|
|||
setup: function() {
|
||||
var thisObject = this,
|
||||
$this = $( thisObject ),
|
||||
scrolling,
|
||||
timer;
|
||||
|
||||
function trigger( event, scrolling ) {
|
||||
$this.data( "ui-scrolling", scrolling );
|
||||
function trigger( event, state ) {
|
||||
scrolling = state;
|
||||
var originalType = event.type;
|
||||
event.type = scrolling ? "scrollstart" : "scrollstop";
|
||||
$.event.handle.call( thisObject, event );
|
||||
|
|
@ -35,7 +36,7 @@ $.event.special.scrollstart = {
|
|||
return;
|
||||
}
|
||||
|
||||
if ( !$this.data( "ui-scrolling" ) ) {
|
||||
if ( !scrolling ) {
|
||||
trigger( event, true );
|
||||
}
|
||||
|
||||
|
|
@ -143,3 +144,16 @@ $.event.special.swipe = {
|
|||
});
|
||||
}
|
||||
};
|
||||
|
||||
$.each({
|
||||
scrollstop: "scrollstart",
|
||||
taphold: "tap",
|
||||
swipeleft: "swipe",
|
||||
swiperight: "swipe"
|
||||
}, function( event, sourceEvent ) {
|
||||
$.event.special[ event ] = {
|
||||
setup: function() {
|
||||
$( this ).bind( sourceEvent, $.noop );
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue