Troubleshooting a Small Scrollbar Problem: Implementing Borders on Your Scrollbar

I'm having trouble defining a border for my scrollbar using Tiny Scrollbar. Whenever I try to do so, the scroll height value is incorrect. Even when using padding, I encounter the same issue. How can I resolve this issue?

.scrollable .track {
    background-color: #D8EEFD;
    height: 100%;
    width:13px;
    position: relative;
    border-radius:6px;
    border:1px solid #fff;
}

http://jsfiddle.net/qYMrN/

Answer №1

It seemed that the issue was the scroll bar not fitting into the 200px window when a border is added. Here is the solution I came up with.

To start, in the CSS, I set the height to 198 pixels to accommodate the border.

.scrollable .track { background-color: #D8EEFD; width:13px; position:relative; height:198px; border-radius:6px; border:1px solid #fff;}

Then in jQuery, I informed the plugin that the height is 198px.

$(".scrollable").tinyscrollbar({ size: 198 });

This adjustment accounts for the 1px border (x2 as top and bottom have to be counted) and produces the desired result.

fiddle

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

Launching the Bootstrap 5 modal will cause the header and background to shift towards the right side

Currently, I am working with Angular 2 and Bootstrap 5 for the front-end of my project. I noticed that when I open a modal, the header and background shift to the right, covering the scrollbar. Upon closer inspection, I discovered that the HTML code trans ...

Unable to transmit form information using HTML/JavaScript/Express Node application

I'm facing a challenge in developing an app that allows me to input event information and then display it on a map. I'm encountering difficulties at the initial stage when it comes to saving the data. Even though Chrome's Inspect tool indica ...

Displaying content on a click event in AngularJS

I am facing an issue with the ng-show directive not working as expected when a user clicks on an icon. The desired behavior is that the parent div should initially display content, but when the play icon is clicked, the contents of the div should become ...

The jQuery draggable feature ceases to function after it has been dropped

I have a scenario with two divs, each housing a list of quantities and items. These items are draggable, and the div containing them is droppable. The condition here is if an item with the same name exists in the div, it cannot be dropped on that div again ...

JavaScript will continue to process the submit to the server even after validation has been completed

My current challenge involves implementing form validation using JavaScript. The goal is to prevent the form from being sent to the server if any errors are found. I have made sure that my JavaScript function returns false in case of an error, like so: ...

Pagination for comments using ajax in Wordpress

I am currently fetching my Wordpress comments from the database through a custom query and displaying them accordingly. I am utilizing the paginate_links() function in Wordpress to paginate the comments. Below is the code snippet: <div class="commentsW ...

What is the process for incorporating JavaScript-generated coordination into an HTML form?

As a newcomer to Javascript, I am on a mission to integrate geo coordination directly into an HTML form input field. After learning from W3Schools how to generate user latitude and longitude Coordination, I am now eager to input them directly into an HTML ...

Utilize javascript/jquery for transforming HTML table data to JSON

Whenever I click the "+" button, my table rows are dynamically generated. After populating the fields and clicking the submit button next to "+", the JSON data is displayed in the console, as shown in the image below. While generating the JSON data, I aim ...

Fine-tuning the page design

I'm working on a registration page using Bootstrap-5 for the layout. Is there a way to place all elements of the second row (starting with %MP1) on the same row, including the last field that is currently on the third row? See image below: https://i. ...

Chrome successfully handles cross-domain AJAX calls with Windows authentication, whereas Firefox encounters issues with the same functionality

I am facing an issue with my WCF service that uses windows authentication. When I call this service using ajax in Google Chrome, everything works perfectly as the credentials are cached. However, in Firefox, I am receiving a 401 unauthorized error. I would ...

Exporting data from a jQuery table to CSV format

I have customized the jQuery Table to CSV Plugin so that it triggers a browser download of a CSV file. The original function was: function popup(data) { var generator = window.open('', 'csv', 'height=400,width=600'); ge ...

Scale up the font size for all text on the website uniformly

Recently, I decided to switch a website's font to a non-web typeface. However, I quickly realized that the font was extremely thin and difficult to read. I attempted a simple CSS fix using * { font-size:125% }, but unfortunately, it did not have the d ...

Modify the transparency of a form's backdrop without affecting the input fields

I'm attempting to achieve a similar effect as shown in this example on my website form. I've tried using opacity to make the form field background only 20% visible, but it ends up affecting the text inside and when typing. Is there a way to apply ...

Issue with Bootstrap-vue pagination navigation not functioning correctly (unexpectedly refreshes upon clicking a page)

I recently updated my website's gallery pagination by following a helpful guide. However, I encountered a problem where clicking on a new page number refreshes the entire webpage, unlike the smooth transition shown in the tutorial. This is not the beh ...

When utilizing *NgIf, the button will be shown without the accompanying text being displayed

When trying to display either a confirm or cancel button based on a boolean set in my component.ts, I implemented the following code in my HTML: <mat-dialog-actions class="dialog-actions"> <button class="cancel-btn" ...

Retrieve JSON information from External document through Ajax

I'm trying to incorporate an external JS file that contains some sample JSON code. However, I'm encountering an error when I include the sample JSON code in the file, specifically at the ":". Interestingly, when I validate the code using online t ...

How to position a div in the center of another div using HTML

I'm struggling to center the bottom div within a container that includes 3 other divs. Despite trying multiple solutions found online, nothing seems to work. This task should be simple, but for some reason, I can't get it right. .container { po ...

Angular - developing a custom web element to enhance the project

Is there a way to convert a single module into a web component and integrate it within the same project? Specifically, I have 3 modules in my project and I am looking to transform only module1 into a web component and incorporate it seamlessly. Thank you! ...

Load Facebook video onto webpage using ajax technology

I have a database where I store the IDs of videos from Facebook, YouTube, and Vimeo. When I load any video via Ajax, Vimeo and YouTube videos load perfectly. However, Facebook videos do not load properly. The code obtained via Ajax includes a script requir ...

Eliminate the lower boundary of a divisional table

I'm having an issue with displaying images in a div table. Each image has a border at the bottom, which is around 2-5 pixels wide. Unfortunately, as a new user, I am unable to send any images. My main goal is to remove this unwanted border from the ...