如何忽略jquery mobile中的所有CSS元素 [英] How to ignore all CSS elements in jquery mobile
问题描述
我想在移动网页上使用我自己的CSS,但也可以使用jQuery mobile作为菜单幻灯片。
如何忽略所有CSS元素? / p>
我知道 data-role =none
属性会工作,但不能应用于我的所有元素。
我也试过在jQuery CSS后包含我的CSS,但是没有工作。
您可以在中将
事件处理程序,因此jQuery Mobile不会自动初始化任何东西。然后,您可以通过在其父元素上调用 autoInitializePage
选项设置为 false
mobileinit .trigger(create)
来初始化单个窗口小部件或窗口小部件集。
文档: http://jquerymobile.com/demos/1.1。 1 / docs / api / globalconfig.html
这是一个演示: http://jsfiddle.net/bBTtN/1/
请注意,您需要绑定到<$ c $
例如:
p> < link rel =stylesheethref =http://code.jquery.com/mobile/1.1.1/jquery .mobile-1.1.1.min.css/>
< script src =http://code.jquery.com/jquery-1.7.1.min.js>< / script>
< script>
$(document).on(mobileinit,function(){
$ .mobile.autoInitializePage = false;
});
< / script>
< script src =http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.js>< / script>
另请注意,默认情况下,jQuery Mobile设置 visibility:hidden
在< body>
元素,因此您需要一个CSS规则覆盖:
body {
visibility:visible!important;
}
I want to use my own CSS on a mobile webpage, but also use jQuery mobile for a menu slide.
How can I ignore ALL their CSS elements?
I know data-role="none"
attribute would work, but can't apply it to all my elements.
I also tried including my CSS after jQuery CSS, but it didn't work.
You can set the autoInitializePage
option to false
in a mobileinit
event handler so jQuery Mobile won't automatically initialize anything. You can then initialize a single widget or set of widgets by calling .trigger("create")
on their parent elements.
Documentation: http://jquerymobile.com/demos/1.1.1/docs/api/globalconfig.html
Here is a demo: http://jsfiddle.net/bBTtN/1/
Note that you need to bind to the mobileinit
event in the proper place, after jQuery core has been included but before jQuery Mobile has been included.
For example:
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.css" />
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script>
$(document).on("mobileinit", function () {
$.mobile.autoInitializePage = false;
});
</script>
<script src="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.js"></script>
Also note that by default, jQuery Mobile sets visibility : hidden
on the <body>
element, so you'll need a CSS rule to overwrite that:
body {
visibility : visible !important;
}
这篇关于如何忽略jquery mobile中的所有CSS元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!