CSS 不透明度在 Phonegap 中不起作用
我在手机间隙应用程序中使用 jQuery 禁用了一个按钮。 href 已删除,但按钮的不透明度不起作用,因此它看起来像一个损坏的按钮。有人可以让我知道更好的方法来解决这个问题或者更好的方法来完成这项工作吗?先感谢您!
这是我的代码:
jQuery.each(rolesArray, function() {
if (this == "USER") {
$('#disable-button').css( 'opacity', '.5');
$('#disable-button').removeAttr('href');
}
});
这是 HTML:
<div class="ui-block-b">
<a href="#search" data-role="button" data-transition="flip" id="disable-button"><img src="images/logo.png" alt="Search" /></a>
</div>
I have a button I have disabled using jQuery in my phone gap application. The href is removed BUT the opacity of the button is not working so it looks like a broken button. Can someone let me know a better way to go about this or a better way to have this work. Thank you in advance!
Here is my code:
jQuery.each(rolesArray, function() {
if (this == "USER") {
$('#disable-button').css( 'opacity', '.5');
$('#disable-button').removeAttr('href');
}
});
Here is the HTML:
<div class="ui-block-b">
<a href="#search" data-role="button" data-transition="flip" id="disable-button"><img src="images/logo.png" alt="Search" /></a>
</div>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(3)
我在用动画显示蒙版时遇到了类似的问题:
但是,虽然这在浏览器中有效,但方法 css() 在 PhoneGap 中返回错误的值,并且屏幕完全空白(蒙版不透明度=1)。
所以我只是通过将不透明度值硬编码到 JS 中来解决这个问题:
I had similar problem with displaying mask with animation:
But while this works in browsers, method css() returns wrong value in PhoneGap and the screen gets completely blank (mask opacity=1).
So I simply fixed this with hardcoding the opacity value into JS:
我认为您想要将不透明度设置为 0.5 的是“img”标签,而不是锚点。
I think that it is the "img" tag that you want to set the opacity to 0.5, not the anchor.