官术网_书友最值得收藏!

jQuery Mobile, links, and you

When jQuery Mobile encounters a simple link (<a href="something.html">Foo</a>), it will automatically capture any clicks on that link and change it to an AJAX-based load. This means that if it detects that the target is something on the same page, that is, the hashmark style (href="#foo") links we used in the previous code, it will handle transitioning the user to a new page. If it detects a page to another file on the same server, it will use AJAX to load the page and replace the currently visible one.

If you link to an external website, then jQuery Mobile will leave the link as it is and the normal link behavior will occur. There may be times when you may want to disable jQuery Mobile from doing anything with your links at all. In this case, you can make use of a data attribute that lets the framework know it shouldn't do anything at all. Here is an example:

<a href="foo.html" data-ajax="false">Normal, non-special link</a>

As we saw in Chapter 1, Preparing Your First jQuery Mobile Project, jQuery Mobile makes heavy use of data attributes. It is also very good at letting you disable the behaviors you don't like. As we continue in the book, you will see example after example of something jQuery Mobile does to enhance your website for mobile devices. In all of these cases though, the framework will recognize that there may be times when you may want to disable those features.

主站蜘蛛池模板: 枣阳市| 江门市| 江西省| 文山县| 长泰县| 历史| 靖安县| 工布江达县| 仙居县| 上思县| 吉首市| 巴彦淖尔市| 琼结县| 西昌市| 衡阳县| 贵定县| 英德市| 茌平县| 新绛县| 娱乐| 金阳县| 洪江市| 科尔| 都匀市| 苏州市| 饶阳县| 邯郸市| 本溪| 合川市| 五原县| 彝良县| 兴国县| 阿巴嘎旗| 麻栗坡县| 肇东市| 湘阴县| 汉阴县| 深州市| 广东省| 屏东市| 凤城市|