Home > other >  trying to make scroller black and always visible
trying to make scroller black and always visible

Time:06-07

Need to color scroller black and have it always visible. Here is my example

Right now scroller is white and only visible while scrolling. Here is my css:

[data-scroller="true"] {
  overflow: hidden;
}
.scroller-scrollbar {
  display: none;
  position: absolute;
  z-index: 1000;
  border-top-right-radius: 2px;
  border-top-left-radius: 2px;
  border-bottom-right-radius: 2px;
  border-bottom-left-radius: 2px;
}
.scroller-scrollbar.vertical {
  top: 0;
  right: 0;
  width: 3px;
  height: 100%;
  margin: 0 2px;
}
.scroller-scrollbar.vertical.scroller-inverse {
  left: 0;
  right: inherit;
}
.scroller-scrollbar.horizontal {
  left: 0;
  bottom: 0;
  width: 100%;
  height: 3px;
  margin: 2px 0;
}
.scroller-scrollbar.horizontal.scroller-inverse {
  top: 0;
  bottom: inherit;
}
.scroller-scrollbar.scroller-active {
  display: block;
}
.scroller-scrollbar {
  background-color: #000;
  opacity: 0.32;
}

Here is my HTML:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>Fxp Jquery Scroller Basic Example</title>
    <link href="https://www.jqueryscript.net/css/jquerysctipttop.css" rel="stylesheet" type="text/css">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.0/normalize.min.css" rel="stylesheet" type="text/css">
    <link href="scroller.css" rel="stylesheet">
    <style>
        body {
background: #fafafa;
        }
.container { margin: 150px auto; max-width: 960px; }
        .content {
            background: #eee;
            height: 200px;
            width: 300px;
            border-radius: 3px solid #222;
        }
        p { padding: 2rem 1rem; }
    </style>
</head>

<body><div id="jquery-script-menu">
<div >
<ul>
<li><a href="https://www.jqueryscript.net/other/custom-fxp-scroller.html">Download This Plugin</a></li>
<li><a href="https://www.jqueryscript.net/">Back To jQueryScript.Net</a></li>
</ul><div id="carbon-block"></div>
<div ><script type="text/javascript"><!--
google_ad_client = "ca-pub-2783044520727903";
/* jQuery_demo */
google_ad_slot = "2780937993";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="https://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>
<div ></div>
</div>
</div>
<textarea  data-scroller="true" data-prevent-mouse-scroll="true" style="overflow-y: scroll; border-radius: 25px;" rows="10" cols="10">
"But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?""But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?""But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?""But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?""But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?"
</textarea>
<script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha384-nvAa0 6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" crossorigin="anonymous"></script>
<script src="scroller.js" async="async"></script>
<script>
try {
  fetch(new Request("https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js", { method: 'HEAD', mode: 'no-cors' })).then(function(response) {
    return true;
  }).catch(function(e) {
    var carbonScript = document.createElement("script");
    carbonScript.src = "//cdn.carbonads.com/carbon.js?serve=CK7DKKQU&placement=wwwjqueryscriptnet";
    carbonScript.id = "_carbonads_js";
    document.getElementById("carbon-block").appendChild(carbonScript);
  });
} catch (error) {
  console.log(error);
}
</script>
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-36251023-1']);
  _gaq.push(['_setDomainName', 'jqueryscript.net']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www')   '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
</body>

</html>

Please help.

Thanks

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

CodePudding user response:

you could use ::-webkit-scrollbar{} to target your scroll bar and change its appearance.

You could also use .div_class{ overflow-y:scroll;} to always show your scroll bar in your desired div.

See my snippet below

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>

  <style>
    *{
      font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
    }
    .blur_container{
      border-radius: 20px;
      width:450px;
      height: 450px;
      background-image: url("https://picsum.photos/450/450");
      display:flex;
      justify-content: center;
      align-items: center;
    }
    .blur_cont{
      width: 425px;
      height: 425px;
      color: rgb(0, 0, 0);
      border-radius: 20px;
      background-color: #aec2eb48;
      vertical-align: middle;
      text-align: center;
      backdrop-filter: blur(8px);
      overflow-y: scroll;
    }

    .body_text{
      padding: 20px;
    }

    /* width */
::-webkit-scrollbar {
  width: 10px;
}

/* Track */
::-webkit-scrollbar-track {
  background: #9e9a9a; 
}
 
/* Handle */
::-webkit-scrollbar-thumb {
  background: rgb(54, 54, 54); 
}

/* Handle on hover */
::-webkit-scrollbar-thumb:hover {
  background: rgb(0, 0, 0); 
}
  </style>
</head>
<body>
  <div >
    <div >
      <p >
        <span style="font-size:60px; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;">Purchace</span><br> 
        Premium to veiw
      </p>
      <br>
      <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Quisquam incidunt cumque veniam eum aperiam quis commodi sequi recusandae voluptates nam eligendi unde quos quia modi rem ratione, aliquam eos numquam?
        Lorem ipsum, dolor sit amet consectetur adipisicing elit. Quibusdam id omnis cupiditate non at dolore! Quia odio quos numquam beatae, libero neque vel quam excepturi dolores. Eum quidem expedita iure!
        Lorem ipsum dolor sit amet consectetur adipisicing elit. Nihil explicabo qui aspernatur ex, quas itaque accusantium quibusdam aliquam consequuntur architecto reprehenderit error harum libero! Ipsam fugiat error cupiditate eveniet non?
        Lorem ipsum, dolor sit amet consectetur adipisicing elit. Nisi consequatur quo perferendis quibusdam. Ad iusto minima saepe laboriosam, omnis eaque tempore officia facere, quisquam cum adipisci culpa voluptatibus dolorum! Error?
      </p>
    </div>
  </div>
</body>
<script>
</script>
</html>

CodePudding user response:

html ::-webkit-scrollbar {
    width: 15px;
}

html ::-webkit-scrollbar-thumb {
    height: 7rem;
    border-radius: 0.8rem;
    border: 0.2rem solid transparent;
    background-clip: content-box;
    background-color: #000000;
}

::-webkit-scrollbar use to set css of scrollbar and ::-webkit-scrollbar-thumb use to set thumb css

Try This

  • Related