Slider UI handle in jQuery sliding out of the div container

Could you assist me with a technical issue I am facing? I need to know how and where to prevent the .ui-slider-handle from exceeding the div when it reaches 100%.

Feel free to check out the live preview at https://codepen.io/Melwee/pen/Exjwoyo

I have included a picture to illustrate my question. https://i.sstatic.net/Ylycr.jpg

Answer №1

It's possible that you may not find a definitive answer to your question, but various perspectives can be shared on the topic.

In my opinion, adjusting the margin-left of .ui-slider-handle to something like:

margin-left: -25px;

Additionally, increasing the padding of .lc-slider can enhance the overall appearance:

padding: 5px 20px;

This simple modification might improve the visual appeal of the element.

Explore this link for more insights

Answer №2

To properly position the slider handle, ensure that the left margin is set to half of the disc size, similar to setting the border-radius. Additionally, match the color of the left and right borders of the slider with the widget:

.ui-slider .ui-slider-handle {
  box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.08);
  border: 14px solid #f9f9ff;
  height: 53px;
  width: 53px;
  border-radius: 27px;
  background: #ff4c60;
  cursor: pointer;
  margin-top: -9px;
  margin-left: -27px; /* adjust margin to half of the width */
}

.ui-slider.ui-slider-horizontal {
  border-left: 25px solid #ff4c60 !important;
  border-right: 24px solid #ffffff !important;
}
.ui-slider.ui-slider-horizontal .ui-slider-range-min {
  border-radius: 0;
}

Furthermore, make sure to tweak the footer according to your requirements:

.lc-slider-footer {
    width: 100%;
    padding: 7px 4px; /* custom footer adjustments */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

Unusual actions exhibited by the jQuery inputs

My form has input fields where jQuery turns a specific input (the URL input) into a link. However, I have two URL inputs with HTML IDs url0 and url1. The issue arises when editing the first input (url0), as the second input (url1) becomes visible and any c ...

Angular code causing an unexpected blank page to be printed again

Trying to display the content of my HTML page is proving to be a challenge. I've been utilizing angularPrint, but an issue persists in the form of a second blank page appearing in the preview alongside the actual content. Eliminating this unwanted sec ...

Issues with displaying images in CSS when using HTML 5 canvas drawing

In attempting to draw an image on a canvas using a pre-loaded image and CSS, such as: img.style.backgroundColor="red"; ctx.drawImage(img,0,0,100,100); I have observed that the image is drawn without incorporating the CSS modifications. Are HTML canvases ...

"Efficiently setting up individual select functions for each option in a UI select menu

I've integrated UI Selectmenu into my current project UI selectmenu includes a select option that allows for setting select behavior across all selectmenu options, as shown in the code snippet below: $('.anything'). selectmenu({ ...

Updating elements with jQuery each/ajax during a loop may not take effect

My goal is to refresh a list after receiving data from an ajax call. The process looks like this: $.ajaxSetup({ async: false }); $.ajax(jsonUrl, { dataType: "json", success: function(data) { $.each(data.list, function(k,v) { ...

Rearrange divs from left to right on mobile display

I need help creating a header bar with three elements as shown below https://i.sstatic.net/4njuk.png When viewed on mobile, I want the menu (toggle-icon) to shift left and the logo to be centered. I attempted using push and pull with no success. Is there ...

Exploring the Differences Between Nth-CSS and Jquery

What are the advantages of using the nth function in CSS instead of applying it through jQuery, especially considering its compatibility with IE? Is it better to simply use jQuery from the start and avoid using it in a stylesheet altogether? Hopefully thi ...

Is it possible to set the input form to be read-only?

I need to create a "read-only" version of all my forms which contain multiple <input type="text"> fields. Instead of recoding each field individually, I'm looking for a more efficient solution. A suggestion was made to use the following: <xs ...

Steps for obtaining the current state array post re-ordering column in Angular datatables

I am facing an interesting scenario where I can successfully retrieve the current state of an array of columns using pure JS + jQuery, but unfortunately, the same approach does not seem to work in Angular 12! Despite going through the documentation for Ang ...

ZeroClipboard intricate CSS issue

I have a list of images with an option box that appears on mouseover. The box contains an embedded code input field for copying purposes. I recently implemented zeroclipboard to enable the copy function on click. However, when I hover over an image and try ...

The visibility of buttons can be controlled based on the selected radio option

I have just completed setting up 4 buttons (add, edit, delete, cancel) and a table that displays data received via ajax. Each row in the table contains a radio button identified by the name "myRadio". When a radio button is clicked, I need the buttons to ...

Obtain POST information through AJAX and jQuery

post.js $.post( "/scripts/update.php", {id: testId, age: testAge}, function(data) { $(".testDiv").html(data.testId); $(".testDiv2").html(data.testAge); } ); update.php $userId = $_POST["id"]; $userAge = $_POST["age]; // contact database ...

Adjust the color of the icon depending on the value

I am new to Angular2 and I'm looking for a way to dynamically change the CSS of an icon based on specific values. Here is the code in HTML: <li><i class="fa fa-check" [style.color]="'switch(types)'"></i>{{ types }}</l ...

The CSS is not displaying correctly on Safari and Chrome browsers in Mac OS

I'm having trouble with CSS not loading properly on Apple devices for a website I made. Despite maintaining all media query statements and style sheets separately, the display is not correct in MAC OS safari and chrome. However, everything looks fine ...

In Google Chrome, the edges of hexagons appear jagged and not smooth

I have encountered an issue in Chrome where I created a hexagon group using HTML and CSS. While it displays fine in Firefox, the edges of the hexagons appear distorted in Chrome. Here are my code snippets: HTML <div class="col-sm-12 margin-left-100" i ...

Obtaining serverTime from a webpageWould you like to learn

Is it possible to retrieve the serverTime using jquery ajax functions like $.get() or $.post()? I am looking to store this serverTime in a variable that can be utilized later on in javascript. You can access the webpage at: To use the get and post functi ...

What is the best way to display and conceal various elements with each individual click?

Utilizing the onClick function for each triggering element, I have implemented a show/hide feature for multiple element IDs upon click. The default setting is to hide the show/hide elements using CSS display property, except for the initial 3 main elements ...

Please indicate the number of lines for the href within the span element

I'm struggling with formatting a <span> tag, specifically the .lastMessageLink class that contains an <a> element with the .lastMessageText class. The content within .lastMessageText can vary from just a few characters to a lengthy paragra ...

Is it necessary for HTML "buttons" to follow the same box-model as other elements?

I recently encountered an issue with the button element and the input element when using a type of button. In both Firefox and Chrome, I noticed a behavior that seems like a bug in recent releases. However, as form elements often have exceptions to W3 rule ...

How to include a blank option in a DropDownListFor with select2 integration

I am looking to explicitly add an empty value for use with jQuery. $('#empId').select2({ placeholder: "Select report type", allowClear: true, width: "265px" }); Is there a way to make this empty value appear as the first option in t ...