loopj / jquery-simple-slider

Unobtrusive numerical slider plugin for jQuery
194 stars 113 forks source link

Round off #51

Open lesleylinnett opened 10 years ago

lesleylinnett commented 10 years ago

Simple Slider - how can I round off the output to no decimal places?

dangercris commented 10 years ago

you need bind the slider change function and data.value.toFixed(0)

like this:

$("[data-slider]").each(function () {
        var input = $(this);
        $("<span>")
            .addClass("output")
            .insertAfter($(this));
    }).bind("slider:ready slider:changed", function (event, data) {
        $(this)
            .nextAll(".output:first")
            .html(data.value.toFixed(0));
    });
alexontheedge commented 10 years ago

How and where do I add this? I have found [data-slider] in simple-slider.js but this can't be a straight swap - maybe my file is a different version - I downloaded the latest from the website. Can you please give more of idea or upload an example with this merged into the script. Many thanks for your help.

alexontheedge commented 10 years ago

Apologies, I have just seen where to add this, doh.