/**
* The issue with this is that it does not support transparent track :/
* scrollbar css does not support transitions, so to go around this we are using a mask-image. The
* mask covers the scrollbar using the width of the scrollbar and a super-tall, arbitrary height
* of 20000px. When the user hovers over the content, the mask is transitioned away from
* scrollbar.
*/
/**
* show thumb on hover
* no transition
* overlay is deprecated, but then transparent trackbar works
*/
body {
background-color: antiquewhite;
width: 100vw;
height: 100vh;
overflow: hidden;
margin: 0;
padding: 0;
}
.content {
margin: -17px 0 0 0;
padding: 0;
width: 100%;
height: calc(100% + 17px);
overflow-y: scroll;
overflow-x: hidden;
mask-image: linear-gradient(to top, transparent, black),
linear-gradient(to left, transparent 17px, black 17px);
mask-size: 100% 20000px;
mask-position: left bottom;
-webkit-mask-image: linear-gradient(to top, transparent, black),
linear-gradient(to left, transparent 17px, black 17px);
-webkit-mask-size: 100% 20000px;
-webkit-mask-position: left bottom;
transition: mask-position 0.3s, -webkit-mask-position 0.3s;
}
.LeftNav_scrollable {
width: 100%;
height: 2000px;
background-color:#ff00ff;
}
.content::-webkit-scrollbar-thumb {
transition: background-color 0.3s;
-webkit-transition: background-color 0.3s;
background-color: rgba(255, 255, 255, 0);
border-radius: 50px;
}
.content:hover {
-webkit-mask-position: left top;
}
JavaScript
// https://css-tricks.com/scrollbars-on-hover/
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.