所有链接上的jQuery移动数据转换 [英] jQuery mobile data-transition on all links
本文介绍了所有链接上的jQuery移动数据转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请帮助我.在jQuery mobile中,如何为"a
"标签(例如"pop")定义默认的data-transition
属性?我已经尝试过$("a").attr("data-transition", "pop");
,但是如果没有data-transition
属性,它不会对链接产生影响.
Please help me. In jQuery mobile, how I can define a default data-transition
attribute for "a
" tags(e.g. "pop")? I have tried $("a").attr("data-transition", "pop");
but it doesn't affect on the links, without data-transition
attribute.
默认的data-transition
值为淡入淡出".
The default data-transition
value is "fade".
谢谢您的回答.
推荐答案
您可以通过这种方式设置jQuery Mobile的默认值.
You can set defaults of jQuery Mobile this way.
<head>
<script src='jquery.js'></script>
$(document).on('mobileinit', function() {
$.mobile.defaultPageTransition = 'pop'; // pages / popup transition
$.mobile.defaultDialogTransition = 'pop'; // dialogs
});
<script src='jquery_mobile.js'></script>
</head>
此类设置应在jQuery之后和jQuery Mobile加载之前加载.
Such settings should be loaded after jQuery and before jQuery Mobile is loaded.
这篇关于所有链接上的jQuery移动数据转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文