Events in jQuery Mobile are:
- tap
- taphold
- swipe
- swipeleft
- swiperight
- orientationchange
- scrollstart
- scrollstop
- pagebeforeshow
- pagebeforehide
- pageshow
- pagehide
- pagebeforecreate
- pagecreate
- vmouseover
- vmousedown
- vmousemove
- vmouseup
- vclick
- vmousecancel
One may bind to these events as one would to any other. And by bind, I mean this stuff:
- $('#foo').bind('click', function() {
alert($(this).text());
}); - $('#bar').live('click', function() {
alert($(this).text());
}); - $("table").delegate("td", "hover", function(){
$(this).toggleClass("hover");
}); - bind effects immediate entities
- live effects those that may appear later too
- it seems delegate takes three parameters
- delegate is a marginally more performant version of live
- delegate must be declared before the thing it effects comes into memory (I think)
Binding to pageCreate() or pageInit() like this may be wise...
$('#foo').live('pagecreate', function(event) {
alert($(this).text());
});
...as this yells:
Important: Use pageCreate(), not $(document).ready()
No comments:
Post a Comment