我正在尝试在 jQuery Mobile 按钮上制作简单的淡入和淡出,但它似乎不起作用?
示例位于 jsfiddle:http://jsfiddle.net/NXRBc/
JS:
function blinking(elm) {
setInterval(blink, 10);
function blink() {
elm.fadeOut(100, function() {
elm.fadeIn(100);
});
}
}
blinking($("#ONEButton"));
HTML:
<div data-role="content">
<div class="ui-grid-b" data-position="fixed">
<div class="ui-block-a"><button id="ONEButton" type="v" data-theme="d">ONE</button></div>
<div class="ui-block-b"><button type="v" data-theme="d">TWO</button></div>
<div class="ui-block-c"><button type="v" data-theme="d">THREE</button></div>
</div>
</div>
最佳答案
jQuery mobile 使用动态生成元素包装button
元素并隐藏按钮,请选择最接近的包装div
元素:
blinking($("#ONEButton").closest('div.ui-block-a'));
或者:
blinking($('div.ui-block-a'));
关于jquery - 无法为 jQuery Mobile 按钮元素设置动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16754913/