Custom image descriptor for nouislider

I use noUislider with a lot of influence on my site. Today I had the idea to change the handles from boring rounded rectangles to images. I thought it would be just adding css 'background-image', but it turned out to be impossible to display my images. Am I here to show someone?

The author of noUislider suggested the following css in a post https://github.com/leongersen/noUiSlider/issues/172 :

.noUi-handle {
  background-image: url('/path/to/your/image.png');
}

I added this to the jquery.nouislider.css file, but this will not work. if the coding of the authors does not work, then there is little hope. I currently have:

.noUi-handle {
    border: 1px solid #cccccc;
    border-radius: 5px;
    background: #fff; /* For Safari 5.1 to 6.0 */
    cursor: col-resize;
    box-shadow: inset 0 0 1px #FFF,
                inset 0 1px 7px #EBEBEB,
                0 3px 6px -3px #BBB;
}

and when I change this to (replacing the background with the background image):

.noUi-handle {
    border: 1px solid #cccccc;
    border-radius: 5px;
    background-image: url(images/handle.png);
    cursor: col-resize;
    box-shadow: inset 0 0 1px #FFF,
                inset 0 1px 7px #EBEBEB,
                0 3px 6px -3px #BBB;
}

, . - ? ! .

+4
1
.noUi-handle {
    border: 1px solid #cccccc;
    border-radius: 5px;
    background-color: #fff; /* For Safari 5.1 to 6.0 */
    background-image: url(images/handle.png);
    background-size: 100% 100%;
    background-repeat: no-repeat;
    cursor: col-resize;
    box-shadow: inset 0 0 1px #FFF,
                inset 0 1px 7px #EBEBEB,
                0 3px 6px -3px #BBB;
}

: use = > !important

background-image: url(images/handle.png)!important;
background-size: 100% 100%!important;
background-repeat: no-repeat!important;
+5

All Articles