简体   繁体   English

JQuery mobile更改了html代码

[英]JQuery mobile changes html code

I'd like use jqm to detect swipe, but if I add that to my code I see HTML code changed!! 我想使用jqm来检测滑动,但如果我将其添加到我的代码中,我会看到HTML代码已更改!!

For example, input radio elements are wrapped by 例如,输入无线电元素被包装

<div class=" ui-radio"> </div> <div class =“ui-radio”> </ div>

Can I inhibit this behavior? 我可以抑制这种行为吗?

I've found the solution: 我找到了解决方案:

add this piece of script before you load the jQuery mobile library: 在加载jQuery移动库之前添加这段脚本:

<script type="text/javascript">$(document).bind("mobileinit", function(){$.extend( $.mobile , {autoInitializePage: false})});</script> <script type =“text / javascript”> $(document).bind(“mobileinit”,function(){$ .extend($ .mobile,{autoInitializePage:false})}); </ script>

This prevents jquery mobile from initializing the page and touching the DOM, thus leaving your layout alone (thanks to eivers88) 这可以防止jquery mobile初始化页面并触摸DOM,从而使您的布局单独处理(感谢eivers88)

Adding data-role="none" to the element should stop jQuery Mobile from adding those additional classes. 向元素添加data-role="none"应该会阻止jQuery Mobile添加其他类。

Source: jQuery Mobile Demo 资料来源: jQuery Mobile Demo

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM