Articles from the category : Javascript (2 articles)
Easily add a dual-slider to your HTML forms
When designing HTML forms, you may quickly find yourself limited by the basic form elements provided. For example, if you use sliders with the <input type="range"> element, they only allow the use of a single slider per element. However, there may be times when you need a field with two sliders to select a minimum and maximum value, such as for choosing a price range in a search form. Double Slider Field This is a problem I faced and for which I developed a solution to easily create a...
Avoiding slowdowns of a JavaScript counter on an inactive tab
If you're trying to create a Javascript counter that increments every second, you may notice that it works correctly when you're on the active tab but experiences slowness when the tab is not active. This can lead to a desynchronization between the counted seconds and real-time. Here's a simple method to address this issue You can use Date.now() to get the number of milliseconds elapsed since January 1, 1970. Here's an example code snippet: var tsDepart = Date.now(); var secondes = 0; var...