Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8535123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:21:35+00:00 2026-06-11T10:21:35+00:00

In my webpage I am trying to get a custom scroll bar. It is

  • 0

In my webpage I am trying to get a custom scroll bar. It is working fine.

Now I have a theme button which allows user to choose either a black theme or a white theme. For this I wrote two css files, one carbon.css and another quartz.css

When a user clicks on one of the themes, I am updating the css file with the below function.

I am able to see all changes correctly except the scroll bar. Until I hover my mouse over the scroll bar, that css change is not happening.

To be more clear, suppose i am in black theme. I am seeing black scroll bar. Now when I click the white theme, I am seeing all my background, text changing properly to white theme. But the scroll bar still remains in black theme. Once I move my mouse on to scroll bar it is updating the scroll bar to white theme.

How can I solve this problem?

Thanks!

Hey Anubav: here is the code I am working after including your changes:

trail.html

  <html>
  <head>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <script   type="text/javascript" src="./jquery-1.7.1.min.js"></script>
  <link href="./carbon.css" rel="stylesheet" type="text/css" id="extCSSFile"/>
  <script type="text/javascript">
  $(document).ready(function() {
  function changeAndPaint(that){

        var filename = $(that).attr('data-href');

    $('#extCSSFile').attr('href',filename);
        var newfile = $('#extCSSFile');

        $('#extCSSFile').remove();
        $(that).css('display','none').height(); //<--this is the trick to repaint
        $(that).css('display','inherit');       


        var elem = $('<link href="" rel="stylesheet" type="text/css" id="extCSSFile"/>');
        $(elem).attr('href',filename);  
        $('head').append(elem);

    }

        $('#carbonTheme,#quartzTheme').on('click', function(){
                changeAndPaint($(this));
            }); 
            });
            </script>
   </head>
  <body>
 <ul id="nav">
    <li id="carbonTheme" data-href="./carbon.css">carbon Theme </li>
    <li id="quartzTheme" data-href="./quartz.css">Quartz Theme </li>
 </ul>      
  <div> 
           <p>There are no results</p>
            <p>There are no results</p>
            <p>There are no results</p>
            <p>There are no results</p><p>There are no results</p>
            <p>There are no results</p>
            <p>There are no results</p>
            <p>There are no results</p><p>There are no results</p>
            <p>There are no results</p>

            <p>There are no results</p>
            <p>There are no results</p>
            <p>There are no results</p>
           <p></p>
           <p></p><p></p><p></p><p></p><p></p>
           <p></p><p></p><p></p><p></p><p></p>
           <p></p><p></p><p></p><p></p><p></p>
           <p></p><p></p><p></p><p></p><p></p>
           <p></p>


            </div>
            </body>
            </html>

carbon.css

body {
    font-family: Arial, Helvetica, sans-serif;      
    font-size:8.5pt;  
    width:inherit;
    min-width:100px;
    max-width:250px;
    margin:10px;
    background-color:#191919;
    color:white;    
}

 ul{height:1000px;}

 #carbonTheme, #quartzTheme{ 
 text-decoration:underline;
 color:blue;
  }
  ::-webkit-scrollbar {
    width: 12px;
 }

::-webkit-scrollbar-track {
 background-color:#aaa;
}

::-webkit-scrollbar-thumb {

  background-color:black;
}

quartz.css

body {
    font-family: Arial, Helvetica, sans-serif;      
    font-size:8.5pt;  
    width:inherit;
    min-width:100px;
    max-width:250px;
    margin:10px;

 }
  ul{height:1000px;}

  #carbonTheme, #quartzTheme{ 
  text-decoration:underline;
  color:blue;
 }
 ::-webkit-scrollbar {
 width: 12px;
 }

 ::-webkit-scrollbar-track {
  background-color:#333;
 }

  ::-webkit-scrollbar-thumb {

   background-color:white;
 }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T10:21:36+00:00Added an answer on June 11, 2026 at 10:21 am

    To force the browser to repaint the complete DOM just do $("#body").offset().Top; ( body is the ID given to body tag to speed up the selector )

    A simple approach to your task can be just add a attribute disabled="disabled" to your link element

    Include LINK in HEAD section as :

    <link href="./carbon.css" rel="stylesheet" type="text/css" id="carbonCSS" />
    <link href="./quartz.css" rel="stylesheet" type="text/css" id="quartzCSS" disabled="disabled" />
    

    Include Script Below the link as :

     <script   type="text/javascript" src="./jquery-1.7.1.min.js"></script>
    <script type="text/javascript">
          $(document).ready(function() {
                $('#nav li').on('click', function(){
                        objLink = document.getElementById($(this).attr("data-href"))
                        $("#carbonCSS , #quartzCSS").attr("disabled","disabled");
                        $("#body").offset().Top;  // Force Repaint
                        objLink.removeAttribute("disabled");
                    }); 
            });
     </script> 
    

    Complete html page may look like :

    <!DOCTYPE html>
    <html>
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    
      <link href="./carbon.css" rel="stylesheet" type="text/css" id="carbonCSS" />
      <link href="./quartz.css" rel="stylesheet" type="text/css" id="quartzCSS" disabled="disabled" />
    
       <script   type="text/javascript" src="./jquery-1.7.1.min.js"></script>
        <script type="text/javascript">
          $(document).ready(function() {
                $('#nav li').on('click', function(){
                        objLink = document.getElementById($(this).attr("data-href"))
                        $("#carbonCSS , #quartzCSS").attr("disabled","disabled");
                        $("#body").offset().Top;
                        objLink.removeAttribute("disabled");
                    }); 
            });
        </script>
       </head>
    <body id="body">
     <ul id="nav">
        <li id="carbonTheme" data-href="carbonCSS">carbon Theme </li>
        <li id="quartzTheme" data-href="quartzCSS">Quartz Theme </li>
     </ul>      
      <div> 
               <p>There are no results</p>
                <p>There are no results</p>
                <p>There are no results</p>
                <p>There are no results</p><p>There are no results</p>
                <p>There are no results</p>
                <p>There are no results</p>
                <p>There are no results</p><p>There are no results</p>
                <p>There are no results</p>
    
                <p>There are no results</p>
                <p>There are no results</p>
                <p>There are no results</p>
               <p></p>
               <p></p><p></p><p></p><p></p><p></p>
               <p></p><p></p><p></p><p></p><p></p>
               <p></p><p></p><p></p><p></p><p></p>
               <p></p><p></p><p></p><p></p><p></p>
               <p></p>
    
    
                </div>
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this small script I'm trying to get working on my webpage, its
I am trying to get my webpage to show zoomed in when the user
I am trying to get the jQuery validation working on a webpage I am
The webpage where I'm trying to get the custom font Duke-Fill to display is
I am trying to get a webpage to have the same setup as livingsocial
I'm trying to get the select element for a particular webpage, but I have
I'm currently trying to create a custom binding for my webpage, where I have
I have been trying to get the links on this webpage to be displayed
I am trying to get a webpage to parse using the following code. <var-def
I'm trying to get the footer on a webpage under my content, regardless of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.