Uresh Vahalia
Uresh Vahalia

Reputation: 11

noUiSlider does not work

I am trying to make noUiSlider work and not getting past the first step. Below is the simplest file I am trying, and it just gives me a blank screen:

<!DOCTYPE html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="It is really easy to use noUiSlider, simply include the files and call the plugin. Find out more!">

    <title>noUiSlider - Getting Started | Refreshless.com</title>

    <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
    <link href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700" rel="stylesheet">

    <link href="/assets/base.css" rel="stylesheet">
    <link href="/assets/prism.css" rel="stylesheet">

    <link href="/nouislider/source/distribute/jquery.nouislider.min.css" rel="stylesheet">
<link href="/nouislider/source/distribute/jquery.nouislider.pips.min.css" rel="stylesheet">

<script src="/nouislider/source/distribute/jquery.nouislider.all.js"></script>
</head>
<body>
<script>
$(function() {                        
   $("#noUiSlider").noUiSlider({
       handles: 2,
       connect: true,
       scale:[10,30],
       start:[0,60]
   });
});
</script>
</body>

What am I doing wrong? I thought I followed the examples on the website.

Upvotes: 0

Views: 1289

Answers (1)

Jonathan P&#233;rez
Jonathan P&#233;rez

Reputation: 21

You need to create a div element on your body that has an id, let's say "slider". Then use var slider = document.getElementById('slider')and the function instead of what you have should be noUiSlider.create(slider, { where the "slider" inside the brackets will be name of the variable you have initialised as the element on your HTML code.

Hope it helps

Upvotes: 1

Related Questions