开发者

Break out of jQtouch?

I'm trying to give my mobile users the choice to view the full website by loading a different page.

Thing is, jQtouch thoughtfully transforms links into ajax calls, so the user doesn't leave the page at all.

Is there some way to break out of jQt or exclude cer开发者_JAVA百科tain links from loading ajaxically?


I had the same question.

Inspecting the source code reveals that you can explicitly add an attribute to stop the library trying to "ajaxify" a link:

target="_blank" is supported for opening links in new windows

rel="external" is supported for the same window.


Just add target="_blank" to your external links and it should work.

http://code.google.com/p/jqtouch/issues/detail?id=9


If you want jQTouch to ignore the external link, then yes just add rel="external" for same-window links or target="_blank" for new-window links. However, a common problem is that jQTouch intercepts all AJAX commands (forms, POST commands, etc) and safely submits them itself. This isn't a problem except for when it's expecting some sort of callback, and there isn't one. In a recent project, I wanted to submit a form without a callback. To do this, look in the jqtouch.js library (around line 434) and comment out the following line:

if (href != '#') {
   $.ajax({
      url: href,
      data: settings.data,
      type: settings.method,
      success: function (data) {
          **// var firstPage = insertPages(data, settings.animation);**

This basically just tells jQTouch to submit the AJAX call but do nothing afterwards. It won't change div's, it won't show any callbacks and it won't call any animations. Hope this helps someone.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜