开发者

Should we be using JQuery for Mobile AJAX Page Navigation?

开发者 https://www.devze.com 2022-12-23 10:50 出处:网络
I am developing a mobile site that will load page content using AJAX if JavaScript is enabled.开发者_JAVA技巧 I have been using the JQuery load() functionality to load page contents from other static

I am developing a mobile site that will load page content using AJAX if JavaScript is enabled.开发者_JAVA技巧 I have been using the JQuery load() functionality to load page contents from other static pages but I feel I am wasting precious bandwidth loading the entire JQuery library when I'm only using a small piece of it. With this said should we be avoiding libraries when only using small pieces of them?


i've experimented with xUI, a small jQuery-like javascript-library which is optimized (so; smaller & faster) for mobile use.


If you are developing mobile web app, using AJAX, it means you are targeting users with smart phones and capable (and flaky) connection. I wouldn't be too concerned about including jQuery, but you may consider putting together small library with only functions you use. You can as well use GWT or Closure to optimize, compile and compress your JS during deployment time.


If you only need a simple XMLHttpRequest object you don't need any library. But if need some more fancy action like fade, slide or something else you should use some, because they get things done. Plan your project in the long term to see which requirements may occur.


Jquery is fairly small, (24kb), not to mention it's going to be cached most likely. (Even higher likely hood if you load it from the google library.)

0

精彩评论

暂无评论...
验证码 换一张
取 消