jDRangeSlider not working with requirejs

97 Views Asked by At

I am trying to get the jQRangeSlider plugin work with requirejs so that I can use it in my project but I am not able to do so.

HTML :

<!DOCTYPE html>
<html>
<head>
    <title>My Sample Project</title>
    <link rel="stylesheet" href="iThing.css" type="text/css" />
    <script data-main="js/main" src="js/require-2.1.14.js" ></script>
</head>
<body>
    <h1>My Sample Project</h1>
    <div id="slider"></div>
</body>
</html>

main.js :

requirejs.config({
    baseUrl: 'js/libs',
    paths: {
        'jquery': 'jquery-min',
        'jqueryui': 'jquery-ui',
        'jQDateRangeSlider' : 'jQDateRangeSlider'
    },shim: {
        "jqueryui": {
            deps: ['jquery']
        },
        "jQDateRangeSlider": {
            deps: ['jquery','jqueryui']
        }
    }
});

require(['jquery', 'jqueryui','jQDateRangeSlider'], function ($) {
     $("#slider").dateRangeSlider();
});

For the plugin : Original : https://github.com/ghusse/jQRangeSlider/blob/master/jQDateRangeSlider.js

I tried using the original but I am getting the error : base not found in jquery-ui. I tried shimming. Also I tried wrapping the function like this : http://pastebin.com/Qh0VniAK but still had no luck. Can anyone guide me how I can make it AMD compatible.

Thank you.

0

There are 0 best solutions below