使用此JSFiddle,编辑后使用两个div而不是两个表($("#id").valueOf().valueOf().valueOf().val();
和#kellypockets
),我正在尝试设置当前显示内容的按钮的样式。
我编写了以下脚本,但似乎没有用(显然,我是新手):
#birkinpockets
$(document).ready(function() {
if ($("#kellypockets").css('display') === 'block') {
$('#button2').addClass("pockets-button-active");
}
if ($("#birkinpockets").css('display') === 'block') {
$('#button1').addClass("pockets-button-active");
}
});
.pockets-button-active {
font-family: "Oswald", sans-serif;
font-weight: 400;
font-style: normal;
font-size: em(14px);
color: #373737;
text-align: center;
text-transform: uppercase;
letter-spacing: 0em;
border-style: solid;
border-bottom: 3px;
border-color: #f5591b;
@include at-query($max, $small) {
font-size: em(12px);
}
}
有人可以帮忙吗?
答案 0 :(得分:1)
你有语法错误,if语句中缺少(
和)
<script>
$(document).ready(function() {
if ($("#kellypockets").css('display') === 'block') {
$('#button2').addClass("pockets-button-active");
}
if ($("#birkinpockets").css('display') === 'block') {
$('#button1').addClass("pockets-button-active");
}
});
</script>