SwipeButton allows jQuery Mobi
SwipeButton is a jQuery Mobile plugin which allows developers to add iPhone style buttons to listview rows by attaching to the swipe event. This project contains everything you need to get started.
jQuery Mobile 1.1 compatiblejQuery Mobile made a slight change in version 1.1 with the way they create buttons inside list views. swipeButton has been updated to account for that change and offers a test case for your perusal.
ExampleView a simple demo of swipeButton
Quick startClone the git repo - git clone git@github.com:commadelimited/jquery.swipeButton.js.git
- or download it
Minimum usage requires that you override the default click event. All other arguments are optional.
$('#swipeMe li').swipeDelete({
click: function(e){
e.preventDefault();
$(this).parents('li').remove();
}
});
$('#swipeMe li').swipeDelete({
direction: 'swiperight', // standard jquery mobile event name
btnLabel: 'Delete',
btnTheme: 'b',
btnClass: 'aSwipeBtn',
click: function(e){
e.preventDefault();
var url = $(e.target).attr('href');
$(this).parents('li').remove();
$.post(url, function(data) {
console.log(data);
});
}
});
Unit Tests
You can now run unit tests on swipeButton by loading tests/jquery.swipeButton.js.html
in the browser of your choice.
You are invited to contribute code and suggestions to this project. The more contributors the merrier.
Project Info Source: http://github.com/commadelimited/jquery.swipeButton.js Twitter: http://twitter.com/commadelimited 3rd party libraries required: jQuery: MIT/GPL license jQuery Mobile: MIT/GPL license Custom bits:Public domain
版权声明:
1、该文章(资料)来源于互联网公开信息,我方只是对该内容做点评,所分享的下载地址为原作者公开地址。2、网站不提供资料下载,如需下载请到原作者页面进行下载。