我试图创建一个根据某些输入填充的动态电表。在仪表上方有一个文本和一个分隔符,随着仪表的变化而移动。这几乎是完美的,我唯一想到的是分频器和文本在动画时是看不见的,并且在动画结束时弹出。怎么解决这个问题?
JSfiddle此处;
HTML:
<div id="meterContainer" class="meterGeneralStyling">
<div id="meter" class="meterGeneralStyling"> <span id="reachSpan">ddd</span><span id="testDivider"></span>
</div>
</div>
<button id="butt">move</button>
JS:
$("#meter").css("width","15%"); //initial value
function resizeReach(width){
$("#meter").animate({
width: ""+width+"%"
}, 1500);
}
$("#butt").click(function(){
resizeReach(Math.floor(Math.random() * 90) + 10 );
});
CSS:
.meterGeneralStyling{
position: relative;
}
#row2{
top: 30px;
}
#meterContainer{
position: relative;
top: 100px;
height: 10px;
z-index: -2;
background-color: #abddff;
overflow: visible !important;
}
#meter{
height: 10px;
background-color: #48B0F7;
position: absolute;
bottom: 0;
}
#reachSpan{
position: absolute;
right: 0;
bottom: 10px;
}
#testDivider{
z-index: 3;
position: absolute;
height: 30px;
border-left: 3px solid red;
right: 0;
bottom: 0px;
}
答案 0 :(得分:1)
只需将overflow: visible !important;
添加到#meter
#meter{
height: 10px;
background-color: #48B0F7;
position: absolute;
bottom: 0;
overflow: visible !important;
}
答案 1 :(得分:0)
你也应该可以看到.meterGeneralStyling
.meterGeneralStyling{
position: relative;
overflow: visible !important;
}