Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery mobile, using controls only?

I am interested in using jquery mobile controls, but only way i can use it is by using "page" tag.

using page does lot of auto injection into html plus links etc goes through ajax for back button. I am not interested in all sort of auto ui.

How can i use just jquery mobile controls(buttons, links, lists etc) without making my whole page jquery mobile page?

like image 358
mamu Avatar asked Jan 25 '11 21:01

mamu


1 Answers

From the jQuery Mobile Alpha 2 release notes:

Global Configuration

jQuery Mobile now has a number of ways to override the initial configuration of a number of aspects of the framework (such as disabled Ajax-style links or forms). This can allow you to sculpt jQuery Mobile to work in situations that are more-specialized and don’t fit the complete design methodology of the framework (giving you the ability to only use a couple widgets rather than the framework as whole, for example).


So, you can work with jQuery Mobile à la carte by disabling the bits you don't want. For example, to disabled the ajaxical navigation and forms:

$(document).live("mobileinit", function() {
    $.mobile.ajaxLinksEnabled = false;
    $.mobile.ajaxFormsEnabled = false;
});

N.B., as the linked docs page says, you'll need to execute your customizing JavaScript (like the snippet above) before the jQuery Mobile is loaded, so import your scripts something like this:

<script src="jquery.js"></script>
<script src="custom-scripting.js"></script>
<script src="jquery-mobile.js"></script>
like image 77
Matt Ball Avatar answered Sep 28 '22 07:09

Matt Ball