jQuery Mobile的超链接按钮的动画不点火 [英] Jquery Mobile Hyperlink-button Animation Not Firing
问题描述
我有两个 JQM
按钮:
<一个ID =clearA的href =#数据角色=按钮>清除一个< / A>
&下;一个ID =clearB的href =#炫魅数据角色=按钮>清除b将; / A>
和我连线了点击事件(超链接/按钮clearA)是这样的:
$(#clearA)。点击(函数(五){
e.stopImmediatePropagation();
亦即preventDefault();
的console.log(我我被点击?);
});
当我点击clearA事件被触发,但按钮不会显示其pressed动画/状态。如果我点击非接线按钮clearB按钮动画。
为什么不扣clearA动画?
更新
我使用JQM 1.1.0
<链接rel =stylesheet属性HREF =HTTP://$c$c.jquery.com/mobile/1.1.0-rc.1/jquery.mobile- 1.1.0-rc.1.min.css/>
&所述; SCRIPT SRC =HTTP://$c$c.jquery.com/jquery-1.7.1.min.js>&下; /脚本>
&所述; SCRIPT SRC =HTTP://$c$c.jquery.com/mobile/1.1.0-rc.1/jquery.mobile-1.1.0-rc.1.min.js>&下; /脚本>
运行这个code从CDN两个按钮以相同的方式工作完全采取了jQuery Mobile的最新版本,你可以尝试使用以下的版本看它是否适合你?
<链接rel =stylesheet属性HREF =HTTP://$c$c.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1。 min.css/>
&所述; SCRIPT SRC =HTTP://$c$c.jquery.com/jquery-1.6.4.min.js>&下; /脚本>
&所述; SCRIPT SRC =HTTP://$c$c.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js>&下; /脚本>
更新:
JQM 1.1仍然是一种不稳定的版本,它有一些粗糙的边缘。使用该版本的所有按钮都正常工作对我来说,这似乎是因为库不分配主题数据正确地归因于按钮。
添加此小改款(以diff格式)的作品:
4216a4217,4218> e.setAttribute(数据 - + $ .mobile.ns +主题,o.theme);
I have two JQM
buttons:
<a id="clearA" href="#" data-role="button">Clear a</a>
<a id="clearB" href="#mainPage" data-role="button">Clear b</a>
And I am wiring up the click event for (hyperlink/button "clearA") like this:
$("#clearA").click(function (e) {
e.stopImmediatePropagation();
e.preventDefault();
console.log("Me? I got clicked");
});
When I click "clearA" the event is fired but the button doesn't show its pressed animation/state. If I click the non wired up button "clearB", the button animates.
Why doesn't button "clearA" animate?
UPDATE I am using JQM 1.1.0
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.0-rc.1/jquery.mobile-1.1.0-rc.1.min.css" />
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.1.0-rc.1/jquery.mobile-1.1.0-rc.1.min.js"></script>
Running this code with the latest version of jquery mobile taken from the cdn both buttons work exactly in the same way, Can you try using the following version to see if it works for you?
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
UPDATED:
JQM 1.1 is still an unstable version and it has some rough edges. Using that version none of the buttons work properly for me and it seems to be because the library doesn't assign the theme data attribute properly to the buttons.
Adding this small modification (in diff format) works:
4216a4217,4218 > e.setAttribute( "data-" + $.mobile.ns + "theme", o.theme );
这篇关于jQuery Mobile的超链接按钮的动画不点火的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!