Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

noUiSlider not appearing

I've seen a couple questions asked about this but none seem to have been solved. I'm trying to use noUiSlider to implement a sliding bar on my website. However it is not appearing at all. I can clearly see the when inspecting the page but otherwise it is like it isn't there.

Here's my code:

<script>
    var slider = document.getElementById('slider');
    //$slider.className = 'noUiSlider';
    //$slider.id = 'slider-range';
    noUiSlider.create(slider, {
        start: 0,
        range: {
            'min': 0,
            'max': 100
        }
    });
</script>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>HELLO</title>
    <link href="{{ url_for('static', filename='nouislider.css') }}">

</head>
<body>

<script src="{{ url_for('static', filename='nouislider.js') }}"></script>


<div id="slider"></div>

</body>

</html>

Any advice or direction would be awesome. This is exactly how they have it on their website.

like image 834
Scragglez Avatar asked Sep 10 '25 15:09

Scragglez


1 Answers

I know this is an old question but I just had the same problem.

I think it's because the <div> target for the slider typically has no content, unless you specify formatting for the element, it's not visible.

Try including the default .css file provided with the control as a starting point and I think you'll see the slider appear.

like image 198
mifydnu Avatar answered Sep 13 '25 04:09

mifydnu