Determine the hue of the scrollbar

My web page features a customized vertical scrollbar within a div box, and I have managed to create a horizontal scrollbar using CSS and jQuery. Now, I am looking for a way to match the color of the custom horizontal scrollbar with the rest of my design. Is there a specific piece of jQuery or JavaScript code that can help me extract the color information from the custom scrollbar?

Answer №1

:-webkit-scrollbar {
    width: 1em;

}

::-webkit-scrollbar-track {
    -webkit-box-shadow: inset 0 0 6px #989898);
}

::-webkit-scrollbar-thumb {
background: -moz-linear-gradient(90deg, rgba(153,218,255,0) 0%, rgba(210,106,120,1) 100%); /* ff3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgba(210,106,120,1)), color-stop(100%, rgba(153,218,255,0))); /* safari4+,chrome */
background: -webkit-linear-gradient(90deg, rgba(153,218,255,0) 0%, rgba(210,106,120,1) 100%); /* safari5.1+,chrome10+ */
background: -o-linear-gradient(90deg, rgba(153,218,255,0) 0%, rgba(210,106,120,1) 100%); /* opera 11.10+ */
background: -ms-linear-gradient(90deg, rgba(153,218,255,0) 0%, rgba(210,106,120,1) 100%); /* ie10+ */
background: linear-gradient(0deg, rgba(153,218,255,0) 0%, rgba(210,106,120,1) 100%); /* w3c */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#d26a78', endColorstr='#99DAFF',GradientType=0 ); /* ie6-9 */ //outline: 1px solid #D17626;
  border-radius:5px;
}

Answer №2

With CSS, you can only set styles for -webkit supported browsers because Firefox does not support scrollbar CSS. To achieve consistent styling across all browsers, you can use plugins like NiceScroll and others.

::-webkit-scrollbar {
    width: 7px;
}

/* Track */
::-webkit-scrollbar-track {
    -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); 
    -webkit-border-radius: 10px;
    border-radius: 10px;
}

/* Handle */
::-webkit-scrollbar-thumb {
    -webkit-border-radius: 10px;
    border-radius: 10px;
    background:#c0a062;
    -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); 
}
::-webkit-scrollbar-thumb:window-inactive {
    background:#c0a062; 
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

jQuery is throwing an error indicating a missing closing parenthesis after the argument list

By using the code snippet below, I am able to add a new row to my table (#courseelements). $("#addbutton").click(function() { $('#courseelements > tbody:last').append('<tr><td>Helloworld</td></tr>'); ...

"Entering a text message will prompt the appearance of the on-screen keyboard in capital

Our website is optimized for use on Android tablets. I have added the following CSS to the input's class: text-transform: uppercase; While this successfully displays typed letters in uppercase, it does not change the appearance of the on-screen keyb ...

How can I easily add both horizontal and vertical arrows to components in React?

Creating a horizontal line is as simple as using the following code: <hr style={{ width: "80%", border: "1px solid black" }} /> You can customize the width, length, and other properties as needed. If you want to display an arrow ...

Center column with header and footer flanking each side

Trying to replicate the layout of the Facebook Android app on my page. The app features a 3 column design, with the central column exclusively displaying the header (no footer included, although I require one for my version). This visual representation is ...

5 Ways to Incorporate Font Awesome Icons into CSS Pseudo Elements

I'm attempting to incorporate FontAwesome icons into CSS pseudo elements. When I add the icon using HTML in the traditional manner, it works fine. However, I'm trying to integrate the fonts into a bootstrap accordion so that the icon changes whe ...

Using Jquery to toggle classes between "display block" and "display none

Hello friends, I'm in need of some help with my code. $(document).ready(function() { var circle = $('.circle'); $(".send a").click(function(e) { e.preventDefault(); $('.wrap').css('display', 'bl ...

Transferring data via AJAX technology

My goal is to empower the ability to upload files using AJAX. I attempted to utilize (JavaScript) in this manner: $("input[type='file']").change(function(){ var file = document.getElementById("uploadelement").files[0]; $.ajax ...

Is it possible to showcase a FullCalendar event in full width while being positioned behind other events scheduled for the same time slot?

Is there a way to customize FullCalendar so that concurrent events in the same timeslot are not vertically divided? I have a Google calendar named "time-blocking template" where I want all events to take up 100% of the timeslot width, even if there are ot ...

I'm curious, is there a specific size at which jQuery Mobile begins to slow down? And if we were to add thousands of LIs

We are currently in the process of deciding between two different methods for presenting device contacts on a mobile application that is running on jQuery Mobile. Our target platform is iPhone. 1) Our first option involves filtering contacts in native co ...

Is it possible to uncheck a checkbox from a list, even if some of them are already unchecked?

I am attempting to implement a feature where checking a checkbox selects all others in the list, and unchecking one deselects all. Currently, only selecting one checkbox allows me to check all the rest, but unchecking one doesn't trigger the reverse a ...

"Enhance user interactions: Zooming in on input fields in

Currently, with the latest version of iOS (14.4), there is a zoom effect on any input box that receives focus, unless the input has a font size of 16px without focus. While this may not seem like an issue initially, once focus moves away from the input bo ...

Tips for getting FormData() to function on Internet Explorer browsers

Is there a way to get this code working on Internet Explorer? I am having trouble with the FormData() API not being supported by IE browsers. Are there any alternative APIs that can be used in place of new FormData() for IE? var fd = new FormData(); fd. ...

Customize the underline color of Material-UI's Input component

Trying to create an input component with a white underline. However, the underline color changes to black when hovering over it. It should remain white. Override the underline class as shown in the demo and instructions below. Despite trying to implement t ...

How is the height or width of the Bootstrap modal determined?

I'm having trouble utilizing Jschr's modified Bootstrap-Modal for different modal sizes. I can't seem to understand why some modals appear taller, wider, or have other specific dimensions. For more information, refer to the documentation: ...

Expanding Vue Tabs with Bootstrap: Manipulating tab-content to perfectly fill parent height

On my webpage, I have implemented a tabs component called b-tabs. This component is enclosed within a parent div with a specific height. I am trying to make the content of the tabs take up the full remaining height of the parent component. https://i.ssta ...

Wordpress is having issues running jQuery

I've developed a function inside js/custom.js. The purpose of this function is to arrange posts in my Wordpress site by applying a class called articleAlign. This class will enhance the spacing between the article title and its excerpt, but only when ...

Conceal objects in reverse sequence

My goal is to clear notifications grouped on a mobile OS style interface when clicking the "X" button. They should be removed in reverse order with a 1-second delay between each. Here's what I've achieved so far: $(document).ready(function () { ...

Tips for locating specific characters and substituting them with designated values

I am looking to identify the index number and then add one to its value. Here is my code example where var newN will output as CmsQuestionaire[9].ChildQuestioner[0].AnswerId. All I need to do is locate the index of ChildQuestioner[0] and increase it by on ...

Tips for transferring a dataTable from C# code behind to jQuery

I am trying to pass a string as a table of data from C# code behind to jQuery using two functions: C# [System.Web.Services.WebMethod(EnableSession = true)] public static List<ListItem> GetImageArray(string AccNo) { string result = string.Empty; ...

Android layout featuring Ionic2 navbar with icons aligned on both sides at the top

<ion-header> <ion-navbar align-title="center" color="primary" hideBackButton> <ion-buttons ion-button icon-only start class="card-buttons"> <button class="card-buttons" (t ...