如何让Anchor Links在Jquery Mobile中运行? [英] How to get Anchor Links to work in Jquery Mobile?

查看:126
本文介绍了如何让Anchor Links在Jquery Mobile中运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Jquery Mobile已决定将锚链接视为排序的页面请求。但是,如果您有大量博客帖子,其中包含指向同一页面的锚点链接(即href =#specs),那就不好了。

Jquery Mobile has decided to treat anchor links as page requests of sort. However, this isn't good if you have a load of blog posts which have anchor links to the same page (ie href="#specs").

是否有一种在特定页面上禁用jquery mobile的锚链接使用的方法,我知道我不会在它上面使用它,所以我可以按照预期使用锚链接,下拉到页面的一部分?

Is there a way to disable jquery mobile's anchor link usage on a specific page which I know I won't be using it on so I can use anchor links as they were intended, to drop down to a part of the page?

我只需要在同一页面上的锚链接解决方案(即:href =#specs)。

I only need a solution for anchor links on the same page (ie: href="#specs").

谢谢

推荐答案

您可以尝试添加 data-ajax =false on锚标记。

You could try adding a data-ajax="false" on the anchor tag.


无Ajax链接

指向其他域或具有rel =external,
data-ajax =false或目标属性的链接将不会加载Ajax。
相反,这些链接将导致整页刷新而没有动画
转换。两个属性(rel =external和data-ajax =false)
具有相同的效果,但具有不同的语义含义:rel =external
应在链接到另一个站点时使用或域,而
data-ajax =false对于简单地选择通过Ajax加载
域中的页面非常有用。由于安全限制,
框架总是选择从Ajax
行为中链接到外部域。

Links that point to other domains or that have rel="external", data-ajax="false" or target attributes will not be loaded with Ajax. Instead, these links will cause a full page refresh with no animated transition. Both attributes (rel="external" and data-ajax="false") have the same effect, but a different semantic meaning: rel="external" should be used when linking to another site or domain, while data-ajax="false" is useful for simply opting a page within your domain from being loaded via Ajax. Because of security restrictions, the framework always opts links to external domains out of the Ajax behavior.

参考 - http://jquerymobile.com/demos/1.0.1/docs/pages/ page-links.html

这篇关于如何让Anchor Links在Jquery Mobile中运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆