jquery - How do I change the css of a different element on hover? -
i creating thermometer graphic looks this:

and highlights section of thermometer on hover. problem first segment created 2 overlapping divs. means when hover on first segment, happens:

how can edit css highlight first segment , circle @ start of thermometer whenever user hovers on either? prefer css-based solution, if isn't possible, happy use javascript/jquery instead. current html , css below.
<div class="thermo"> <div class="startthermo"> </div> <div class="thermopadding"> </div> <div class="thermalcapsule" style="width: 10%"> <div class="thermal thermal1">1</div> 100 </div> <div class="thermalcapsule" style="width: 15%"> <div class="thermal thermal2">2</div> 200 </div> <!-- more html here --> </div> .thermo { width: 95%; margin-left: auto; margin-right: auto; } .thermalcapsule { margin-right: 1px; margin-top: 20px; float:left; text-align: center; cursor: pointer; position: relative; z-index: 1; } .thermalcapsule:hover .thermal1{ background-color: #000000; } .thermoimage { margin-left: -15px; margin-top: 8px; float: left; } .thermopadding { width: 2%; float:left; } .startthermo { width: 50px; height: 50px; border-radius: 50px; background-color: #60a4ce; border: 9px solid #f4f4f4; display: block; float:left; position: absolute; } .thermal { width: 100%; padding: 5px; text-align: center; color: #fff; font-weight: bold; position: relative; z-index : 5; } .thermal1 { background-color: #60a4ce; } .thermal2 { background-color: #437c87; }
i solved problem this, hope helps:
<div class="thermo"> <div class="thermopadding"> </div> <div class="thermalcapsule" style="width: 15%"> <div class="startthermo"> </div> <div class="thermal thermal1">1</div> 100 </div> <div class="thermalcapsule" style="width: 15%"> <div class="thermal thermal2">2</div> 200 </div> <!-- more html here --> </div> .thermalcapsule:hover .startthermo, .thermalcapsule:hover .thermal1{ background-color: #000000; } .startthermo { width: 50px; height: 50px; border-radius: 50px; background-color: #60a4ce; border: 9px solid #f4f4f4; display: block; float:left; position: absolute; margin-left: -35px; margin-top: -20px; }
Comments
Post a Comment