Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$("#id_values").simpleSlider() is not working at all #74

Open
raviSanchala opened this issue Nov 5, 2014 · 1 comment
Open

$("#id_values").simpleSlider() is not working at all #74

raviSanchala opened this issue Nov 5, 2014 · 1 comment

Comments

@raviSanchala
Copy link

$("#id_values").simpleSlider() is not working at all
i am using

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>

and an inputbox with should give value to above slider dynamically.
i am using below code

$("#price_slider").simpleSlider('800',"{500,5000}");

please correct me where i am going wrong.
because whenever i tried to run above code in browser the slider appear with 0 and 1 value and dragger used to be at the 1.

thanks in advance,
Ravi

@vioKamran
Copy link

Hi raviSanchala this work
Add Function :
function sliderX(valueX) {
return valueX.each(function() {
var $el, allowedValues, settings, x;
$el = $(this);
settings = {};
allowedValues = $el.data("slider-values");
if (allowedValues) {
settings.allowedValues = (function() {
var _i, _len, _ref, _results;
_ref = allowedValues.split(",");
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
x = _ref[_i];
_results.push(parseFloat(x));
}
return _results;
})();
}
if ($el.data("slider-range")) {
settings.range = $el.data("slider-range").split(",");
}
if ($el.data("slider-step")) {
settings.step = $el.data("slider-step");
}
settings.snap = $el.data("slider-snap");
settings.equalSteps = $el.data("slider-equal-steps");
if ($el.data("slider-theme")) {
settings.theme = $el.data("slider-theme");
}
if ($el.attr("data-slider-highlight")) {
settings.highlight = $el.data("slider-highlight");
}
if ($el.data("slider-animate") != null) {
settings.animate = $el.data("slider-animate");
}
return $el.simpleSlider(settings);
});
}

and call :

sliderX(slideFilter.find("input")) OR sliderX($("[data-slider]"));

good luck 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants