Pure CSS show on hover demo
Pure CSS show on hover demo
by sandipchitale
HTML
<div>
<span class="hoversource">
<button onclick="incrementLeft()" class="showonhover">➕</button>
<button onclick="collapseContentPanel()">◄</button>
</span>
<span> | </span>
<span class="hoversource">
<button onclick="collapseSidePanel()">►</button>
<button onclick="incrementRight()" class="showonhover">➕</button>
</span>
</div>
<div>
<span> |</span>
</div>
<div>
<span> |</span>
</div>
<div>
<span> |</span>
</div>
<div>
<span> |</span>
</div>
<div>
<span> |</span>
</div>
<div>
<span> |</span>
</div>
<div>
<span> |</span>
</div>
<div>
<span> |</span>
</div>
<div>
<span> |</span>
</div>
<div>
<span> |</span>
</div>
CSS
button {
width: 30px;
height: 30px;
background: none;
border: none;
}
.showonhover {
opacity: 0;
}
.hoversource:hover .showonhover {
opacity: 1;
animation: fadein 2s;
}
@keyframes fadein {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
JavaScript
incrementLeft = function() {
alert('Expand by one column to the left');
return false;
}
collapseContentPanel = function() {
alert('Collapse (hide) content panel');
return false;
}
collapseSidePanel = function() {
alert('Collapse (hide) right side panel');
return false;
}
incrementRight = function() {
alert('Expand by one column to the right');
return false;
}