[英]jquery `css` function doesn't return `border-color` property
I need to get border-color
property and I try to do that with css()
function 我需要获取border-color
属性,然后尝试使用css()
函数来做到这一点
$('.panel-warning').css('border-color')
But its empty 但它是空的
Html HTML
<div class="col-md-4 is-draggable ui-draggable ui-draggable-handle ui-draggable-dragging">
<div class="panel panel-warning">
<div class="panel-heading">Intermediate Outcome</div>
</div>
</div>
CSS 的CSS
.panel-warning {
border-color: #faebcc;
}
You have to go to the individual top, left, right, and bottom properties. 您必须转到各个顶部,左侧,右侧和底部属性。
Firefox won't work unless you do that: 除非您这样做,否则Firefox将无法正常工作:
$('.panel-warning').css('border-left-color')
This is, of course, sort-of a pain and a burden, but those really are separately settable so I don't see that there's any way to avoid having your JavaScript know what to look for. 当然,这是一个痛苦和负担,但是这些确实是可以单独设置的,因此我看不出有什么方法可以避免让您的JavaScript知道要寻找什么。
Chrome apparently does you a favor here, though it may get weird when the different sides really do have different colors. Chrome显然在这里帮了您一个忙,尽管当不同面的确具有不同的颜色时,Chrome可能会变得很奇怪。 (Good bet that it's a core WebKit behavior, meaning that Safari and Opera probably do that too.) (最好打赌这是WebKit的核心行为,这意味着Safari和Opera也可能这样做。)
Try this 尝试这个
$(document).ready(function(){
alert($('.panel-warning').css('border-color'));
});
or put your javascript code at the end of the file, after the html and css code 或将您的JavaScript代码放在html和css代码之后的文件末尾
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.