jQuery Mobile禁用增强某些标签? [英] jQuery Mobile disable enhancement on certain tags?

查看:148
本文介绍了jQuery Mobile禁用增强某些标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不想使用< a> 标签的样式。我发现这样的线程如何 ;关闭 jQuery Mobile的样式< select>下拉?,但我不想添加 data-enhancement = false 到每个锚点。我也希望 linkBindingEnabled 将工作(从 http://jquerymobile.com/demos/1.2.0/docs/api/globalconfig.html ),因为它不会将自定义类添加到< ; a> 标签。

I don't want the styles for the <a> tag. I've found threads like this How to "turn off" jQuery Mobile's styling of <select> drop downs? but I don't want to be adding data-enhance=false to every anchor I have. I was also hoping linkBindingEnabled would work (from http://jquerymobile.com/demos/1.2.0/docs/api/globalconfig.html), as in it wouldn't add custom classes to the <a> tag.

我可以删除CSS文件中的定义,但我更喜欢使用编程方式。例如,我注释掉 .ui-body-c .ui-link (默认链接),但是我的脚注中的链接仍然增强。我确定还有其他小例子,我不想弄乱它(虽然有时候是唯一的选择)

I could delete the definitions in the CSS file, but I'd prefer a programmatic way to do it. For example, I comment out .ui-body-c .ui-link (the default link), but then my links in the footer are still enhanced. And I'm sure there are other little cases, and I don't want to make it messy (although sometimes that's the only option)

基本上,有一种方法禁用元素的选择器的增强?取代手动添加 data-enhancement = false

Basically, is there a way to disable enhancement for a "selector" of elements? Instead of manually adding data-enhance=false

推荐答案

jQuery Mobile 中禁用标记增强的方法,但在您的情况下,只有一个单行解决方案:

There are few ways of disabling markup enhancement in jQuery Mobile but in your case there's only one single line solution:

$(document).on('pagebeforeshow', '#index', function(){       
   $('a').removeClass('ui-link');
});

jsFiddle 示例: http://jsfiddle.net/Gajotres/L4KUT/

其他解决方案可以在我的其他 文章 ,透明它是我的个人博客。或者 此处 。搜索标记增强预防方法章节。

Other solutions can be found in my other ARTICLE, to be transparent it is my personal blog. Or find it HERE. Search for the chapter called: Methods of markup enhancement prevention.

您会发现一个答案如何在选择器级别禁用它它只适用于本机表单元素,并且标记不是本机表单元素:

There you will find a answer how to disable it on a selector level, unfortunately it only works on native form elements and a tag is not a native form element:

$(document).bind('mobileinit',function(){
     $.mobile.page.prototype.options.keepNative = "select, input";
});  

这篇关于jQuery Mobile禁用增强某些标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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