This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function scrollToEl(el) { | |
var rect = el.getBoundingClientRect(), | |
scrollTop = window.pageYOffset || document.documentElement.scrollTop, | |
scrollLeft = window.pageXOffset || document.documentElement.scrollLeft, | |
elTop = rect.top + scrollTop, | |
elLeft = rect.left + scrollLeft; | |
window.scrollTo({ | |
top: elTop, | |
left: elLeft, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Turns a number/string to 2 digits day of the month with leading zero. | |
* @param {number|string} day to turn into day. | |
* @return {string} | |
*/ | |
function numberToDay(j) { | |
return ('0' + j).slice(-2); | |
} | |
// Examples: |