Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

custom image handle for nouislider

Tags:

jquery

css

I'm using noUislider with great effect on my website. Today I had the idea to change the handles from the boring rounded rectangles to images. I thought it would be a simple css 'background-image' addition, but it's proving to be impossible to get my images showing. I anyone here getting an image to show?

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

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

I had added this into the jquery.nouislider.css file however this doesn't work. if the authors coding doesn't 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 background with 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;
}

the handle is transparent, no image. can anyone help me here? such a silly problem! Many thanks.

like image 552
luke_mclachlan Avatar asked Sep 15 '14 00:09

luke_mclachlan


1 Answers

.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;
}

if not work: use=> !important

background-image: url(images/handle.png)!important;
background-size: 100% 100%!important;
background-repeat: no-repeat!important;
like image 153
alessandrio Avatar answered Oct 17 '22 08:10

alessandrio