possible way to make jquery mobile faster? - jquery-mobile

I'm working on mobile web page using jquery mobile, it seems to have almost every required feature but I found it's very slow. Especially, during transition the whole performance is not acceptable. Since I didn't change any configuration about jquery mobile, is there any possible way to make it faster?
I'm testing on iis 8.0 + asp.net MVC 4.0 razor, jquery mobile 1.0

Try using Microsoft's Task Parallel Library on the backend to divvy up the work your controllers need to do. Running in parallel will make it faster. Also, try removing all transitions from JQM. It's less sexy, but will provide more responsiveness on page transitions.
$(document).bind("mobileinit", function() {
//Set your global init settings here
//This is the setting you are looking for!
$.mobile.defaultPageTransition = 'none';
//I personally use some other settings, such as:
$.mobile.page.prototype.options.addBackBtn = true;
$.mobile.useFastClick = false;
}

Related

jQuery Mobile vs. smoothState.js?

If I'm already using jQuery Mobile -- is http://css-tricks.com/add-page-transitions-css-smoothstate-js/ (http://weblinc.github.io/jquery.smoothState.js/) possible / worth it to implement?
I really don't see a benefit of using jQuery Mobile with smoothState.js. jQuery Mobile already can do everything smoothState.js can, you only need to learn how. Though smoothState.js has everything better described, plus you don't need to use gazillion different page events. But to use them both you would need to turn off jQuery Mobile Ajax handling.
Basically I would like to see smoothState.js approach used inside jQuery Mobile framework.
My advice stick to jQuery mobile if you really need its UI, for everything else use smoothState.js, of course if seamless navigation is something you desire.

jQuery Mobile vs AngularJs page navigation

I am developing a hybrid mobile app using jQuery Mobile and AngularJS.
I decided to use a mix of the two for the following:
jQuery Mobile
good UI features
not too heavyweight (compared to Sencha Touch, for example)
AngularJS
good performance and resource management (caching, asynchronous requests)
personal experience
I have little to no experience with jQuery Mobile and, as I was learning, I noticed a potential conflict between the page navigation models of the two.
Should I use only one ?
If yes, which one is better suited for my needs ?
Are there any gotchas with this setup ?
Many thanks.
You can't compare them to each other.
Angular.js (like Backbone, Ember eg.) are MV* Frameworks (for SPA) which used to render html templates/views directly in the client instead of server. So you have a lot of application logic now in your frontend and this Frameworks are made to make your life better, coding this.
jQuery Mobile on the other side is a pure widget/plugin library. The AJAX navigation plugin load pages (something static, like html) into the DOM via AJAX. So you have to pre-render this pages on the server somehow.
If you started to build a SPA with Angular it doesn't make sense to use jQuery Mobile's AJAX navigation at all. (If it's a native mobile app you have no server anyway.)
Sure, you won't get far without an UI component library so use one of your choice (eg. jQM) but work with Angular's directives to init the plugins/widgets correctly on your DOM elements since a $(document).ready(...) or a $(document).on( "pageload", ... ) doesn't know anything about your Angular views.
Take a look at following projects:
http://angular-ui.github.io
https://github.com/angular-widgets/angular-jqm
This has been already addressed in HERE
Basically the article states that trying to intercept the navigation from angular can be painful, so leave all the routing jqm

jQueryMobile Data Binding options

I was going through some basic tutorial on jQueryMobile and would like to know -
what are the different databinding options available for jQueryMobile?
I searched and as a result found only knockoutjs -
Is it the only way to go or can I bind the controls like we generally do for normal html controls?
Essentially, I want to use jQueryMobile with MVC 4 and bind the controls with JSON.
Please guide.
You should be able to treat a jquery mobile site built with MVC just as you do any other MVC application. You may run into issues with jqm based ajax navigation but that can be turned off with data-ajax="false".
http://jquerymobile.com/test/docs/forms/forms-sample.html
You can also make this change globally: "jQuery Mobile will automatically handle link clicks and form submissions through Ajax, when possible. If false, URL hash listening will be disabled as well, and URLs will load as ordinary HTTP requests."
$(document).bind("mobileinit", function(){
$.mobile.ajaxEnabled = false;
});
http://jquerymobile.com/test/docs/api/globalconfig.html
In the end, ajax based navigation is about performance. If you want to go with generic asp.net MVC, you will have to weigh these trade offs.

Any Mobile Framework without jQuery or Javascript

jQuery Mobile is working for my site but slow. Cause of the slowness turned out to be jquery. We searched an alternative but most of them still uses javascript/jquery.
Question: Is there any other framework for mobile with better performance?
Considering Javascript is the core language all web browsers use for programatic changes, unless you want to only change the Visuals via CSS and what it has to offer, I believe you are stuck.
Take a look at Zepto: https://github.com/madrobby/zepto
It still uses JavaScript but with a really small footprint.

asp.net mvc: handling no-javascript

I'm working on a asp.net mvc2 app. I have been using jquery to do various different things in all of my views. They are work from a regular browser quite well. But I'm trying to figure out a good way to get the functionality working with browsers with javascript disabled (like mobile browsers). Is there a way to define a whole different view for non javascript browsers?
A specific example of what I'm trying to do is, I have a <button> with it's onClick calling a javascript that does $.post() to a controller.
What's a good way to make it, so, it works the way it works right now (doing ajax calls) with regular javascript-enabled browsers and it a also works with javascript-incapable browsers, doing a full postback ?
Thanks
I use the unobtrusive javascript approach; get the app working without JavaScript, then add in extensibility with JQuery so that the app will work when scripts are turned off, or if the JS fails to download.
Same approach I believe that #James Kolpack is talking about. This is the true failsafe approach. While you can detect the support of JS by the browser through Request.Browser, this isn't accurate to most of the possible scenarios.

Resources