JS – find currentClosetTo()

By | Tutourial & Tips

Scenario: For every minute that passes, we want to find the closest(current minute for example 2) to the closest step_num (e.g. steps of 3). So for this, if its 2 then its closer to 3. If its 4 then its still closer to 3. If its 5 then its not…

Read More

You don’t need jQuery for Selctors

By | How to, Tutourial & Tips

If you want to use the jQuery style to select elements you can add the below code to your project without loading the full jQuery Library. window.$ = function(selector) { var selectorType = ‘querySelectorAll’; if (selector.indexOf(‘#’) === 0) { selectorType = ‘getElementById’; selector = selector.substr(1, selector.length); } return document[selectorType](selector); };…

Read More