mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-04-27 01:24:41 +00:00
added $.mobile options: ajaxLinksEnabled, ajaxFormsEnabled. Both default to true.
This commit is contained in:
parent
1f7be112c8
commit
02e6e5f26b
1 changed files with 10 additions and 1 deletions
|
|
@ -27,6 +27,12 @@
|
|||
//class used for "active" button state, from CSS framework
|
||||
activeBtnClass: 'ui-btn-active',
|
||||
|
||||
//automatically handle link clicks through Ajax, when possible
|
||||
ajaxLinksEnabled: true,
|
||||
|
||||
//automatically handle form submissions through Ajax, when possible
|
||||
ajaxFormsEnabled: true,
|
||||
|
||||
//available CSS transitions
|
||||
transitions: ['slide', 'slideup', 'slidedown', 'pop', 'flip', 'fade'],
|
||||
|
||||
|
|
@ -163,6 +169,8 @@
|
|||
|
||||
//for form submission
|
||||
$('form').live('submit', function(){
|
||||
if( !$.mobile.ajaxFormsEnabled ){ return; }
|
||||
|
||||
var type = $(this).attr("method"),
|
||||
url = $(this).attr( "action" ).replace( location.protocol + "//" + location.host, "");
|
||||
|
||||
|
|
@ -203,7 +211,7 @@
|
|||
|
||||
activeClickedLink = $this.closest( ".ui-btn" ).addClass( $.mobile.activeBtnClass );
|
||||
|
||||
if( external ){
|
||||
if( external || !$.mobile.ajaxLinksEnabled ){
|
||||
//deliberately redirect, in case click was triggered
|
||||
location.href = href;
|
||||
}
|
||||
|
|
@ -570,6 +578,7 @@
|
|||
}
|
||||
};
|
||||
|
||||
//TODO - add to jQuery.mobile, not $
|
||||
jQuery.extend({
|
||||
pageLoading: pageLoading,
|
||||
changePage: changePage,
|
||||
|
|
|
|||
Loading…
Reference in a new issue