बाह्य श्रेणी के div के अंदर स्तर वर्ग रखें और स्तर वर्ग के अंदर अवधि को अपेक्षाकृत स्थानित करने के लिए शैली दें। जावास्क्रिप्ट में, स्तर की गणना करने के लिए, सही गोलाकार होवर प्रभाव के लिए 100 के बजाय 10 से विभाजित करें।
यहां एक fiddle है।
एचटीएमएल
<div class="outerContainer">
<div class="innerContainer">
<p>Circle 3</p>
<span class="progressBar"></span>
</div>
<div class="level"><span>75</span>
</div>
</div>
सीएसएस
body {
background: blue;
}
#circles {
text-align: center;
margin: 100px 0;
}
li {
display: inline-block;
margin: 0 10px;
position: relative;
}
.outerContainer {
position: relative;
display: block;
height: 96px;
width: 96px;
overflow: hidden;
background: #fff;
border: 2px solid #fff;
-webkit-border-radius: 50px;
border-radius: 50px;
}
.innerContainer {
display: table-cell;
vertical-align: middle;
width: 100%;
margin: 0 auto;
text-align: center;
}
p {
color: #000;
width: 96px;
position: relative;
z-index: 2;
}
.progressBar {
display: block;
width: 100%;
height: 0;
position: absolute;
bottom: 0;
left: 0;
background: #ec6730;
}
.level span{
position:relative;
}
जे एस
$(function() {
$("#circles li").hover(function(){
var thisElement = $(this);
var level = $(this).find(".level").text();
var elementHeight = $(this).find(".outerContainer").height();
level = (level/10)*elementHeight;
$(thisElement).find(".progressBar").stop().animate({
height: level
}, 300);
}, function() {
var thisElement = $(this);
$(".progressBar").stop().animate({
height: 0
}, 300);
});
});
स्रोत
2013-09-09 05:13:19
क्रोम पर ठीक काम करता है, लेकिन फ़ायरफ़ॉक्स सीमा पार होने पर सीमा-त्रिज्या का सम्मान नहीं करता है ... आप किस ब्राउज़र का उपयोग कर रहे हैं? – gustavohenke
क्रोम और फ़ायरफ़ॉक्स दोनों में परीक्षण किया गया, और दोनों पर बग है। – halliewuud
मैंने फ़ायरफ़ॉक्स में थोड़ी देर के लिए इसे झुकाया, और ऐसा लगता है कि 'स्थिति: पूर्ण' कंटेनर से 'ओवरफ्लो: छुपा' के प्रयोजनों के लिए प्रगति पट्टी लेता है। – user1618143