Logarithmic slider

You can use a function like this: function logslider(position) { // position will be between 0 and 100 var minp = 0; var maxp = 100; // The result should be between 100 an 10000000 var minv = Math.log(100); var maxv = Math.log(10000000); // calculate adjustment factor var scale = (maxv-minv) / (maxp-minp); return Math.exp(minv … Read more

Combined total for multiple jQuery-UI Sliders

Well here ya go: var sliders = $(“#sliders .slider”); sliders.each(function() { var value = parseInt($(this).text(), 10), availableTotal = 400; $(this).empty().slider({ value: 0, min: 0, max: 400, range: “max”, step: 10, slide: function(event, ui) { // Update display to current value $(this).siblings().text(ui.value); // Get current total var total = 0; sliders.not(this).each(function() { total += $(this).slider(“option”, “value”); … Read more

HTML slider with two inputs possible?

I’ve been looking for a lightweight, dependency free dual slider for some time (it seemed crazy to import jQuery just for this) and there don’t seem to be many out there. I ended up modifying @Wildhoney’s code a bit and really like it. function getVals(){ // Get slider values var parent = this.parentNode; var slides … Read more

Shiny slider on logarithmic scale

UPDATE (May 2018): This is now possible through the shinyWidgets::sliderTextInput() control. You can specify custom steps (e.g., logarithmic intervals), and the slider steps through those. The downside is that you need to specify each step, rather than a max and min and have the slider calculate the steps, but it works well for this kind … Read more

When using setInterval, if I switch tabs in Chrome and go back, the slider goes crazy catching up

How to detect when a tab is focused or not in Chrome with Javascript? window.addEventListener(‘focus’, function() { document.title=”focused”; },false); window.addEventListener(‘blur’, function() { document.title=”not focused”; },false); To apply to your situation: var autopager; function startAutopager() { autopager = window.setInterval(nextImage, 8000); } function stopAutopager() { window.clearInterval(autopager); } window.addEventListener(‘focus’, startAutopager); window.addEventListener(‘blur’, stopAutopager); Note that in the latest version … Read more

WPF: Slider with an event that triggers after a user drags

Besides using the Thumb.DragCompleted event you can also use both ValueChanged and Thumb.DragStarted, this way you don’t lose functionality when the user modifies the value by pressing the arrow keys or by clicking on the slider bar. Xaml: <Slider ValueChanged=”Slider_ValueChanged” Thumb.DragStarted=”Slider_DragStarted” Thumb.DragCompleted=”Slider_DragCompleted”/> Code behind: private bool dragStarted = false; private void Slider_DragCompleted(object sender, DragCompletedEventArgs e) … Read more

HTML5: Slider with two inputs possible?

I’ve been looking for a lightweight, dependency free dual slider for some time (it seemed crazy to import jQuery just for this) and there don’t seem to be many out there. I ended up modifying @Wildhoney’s code a bit and really like it. function getVals(){ // Get slider values var parent = this.parentNode; var slides … Read more