Transparent background scrollbar displays on top of content
Asked Answered
P

4

14

I want to achieve this:
enter image description here
What I already achieve:
https://plnkr.co/edit/a3XfJo6Fxtru9V5zpVYR?p=preview
enter image description here

.dropdown-menu { //container
    overflow-y: overlay;
    background-color: transparent;
}
.dropdown-menu::-webkit-scrollbar {
    width:10px;
}
.dropdown-menu::-webkit-scrollbar * {
    background:transparent;
}
.dropdown-menu::-webkit-scrollbar-thumb {
    background:$blue !important;
    border-radius: 6px;
}

Does someone have any ideas how I can do that? How can I make the items stay between their container and the container's scrollbar so they looks like the design? I tried putting z-index in the elements but seems not to work.

Pendragon answered 17/1, 2017 at 12:27 Comment(1)
I use this plugin instead. Seems like just css approach does not work. manos.malihu.gr/jquery-custom-content-scrollerPendragon
W
1

Just switch the unit in body tag from % to vw and you will get the over content effect.

body {
  width: 100vw;
  overflow-x: hidden;
}

body::-webkit-scrollbar {
  width: 0.7em;
  background: transparent;
}
body::-webkit-scrollbar-thumb {
  background: #c0392b;
}
Warnke answered 16/12, 2017 at 17:11 Comment(1)
Sadly, this hack only works for the body. It doesn't work for any smaller things like divs.Specter
P
1

Unfortunately the overflow:overlay has be deprecated in all updated browser versions, use scrollbar-gutter instead. kindly check compatability here

Patty answered 27/3 at 6:5 Comment(0)
P
0

http://manos.malihu.gr/jquery-custom-content-scroller/
This plugin works pretty well. Suggested! Easy to modify as well!

Pendragon answered 17/1, 2017 at 13:1 Comment(0)
S
0

Make some changes in your css file use this code

.dropdown-menu::-webkit-scrollbar-track {
    background-color: #E0E0E0;
}

remember to remove display: none; property from your code or change it to display: block;

Scotfree answered 17/1, 2017 at 14:25 Comment(1)
this has nothing to do with the topicMelodee

© 2022 - 2024 — McMap. All rights reserved.