2020-09-20 05:05:57 +00:00
|
|
|
/* @license http://creativecommons.org/publicdomain/zero/1.0/legalcode CC0-1.0 */
|
|
|
|
|
|
|
|
// This component is dedicated to the public domain. It uses the CC0
|
|
|
|
// as a formal dedication to the public domain and in circumstances where
|
|
|
|
// a public domain is not usable.
|
|
|
|
|
2020-05-20 11:12:49 +00:00
|
|
|
function initResetScroll()
|
|
|
|
{
|
|
|
|
var buttons = document.getElementsByClassName("resetScrollLeft");
|
|
|
|
for(index = 0; index < buttons.length; index++)
|
|
|
|
{
|
|
|
|
var button = buttons[index];
|
|
|
|
addBlurHandler(button);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function addBlurHandler(elem)
|
|
|
|
{
|
|
|
|
elem.addEventListener("blur", function() {
|
|
|
|
resetScrollLeft(elem);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-07-27 01:23:06 +00:00
|
|
|
// resets scroll position of element
|
|
|
|
// use with onblur to clear scroll position when element loses focus
|
|
|
|
|
|
|
|
|
|
|
|
// reset scroll to left position
|
|
|
|
|
|
|
|
function resetScrollLeft(element) {
|
|
|
|
element.scrollLeft = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// reset scroll to top position
|
2020-05-20 11:12:49 +00:00
|
|
|
// unused
|
2017-07-27 01:23:06 +00:00
|
|
|
function resetScrollTop(element) {
|
|
|
|
element.scrollTop = 0;
|
2020-05-20 11:12:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
document.addEventListener("DOMContentLoaded", function() {
|
|
|
|
initResetScroll();
|
|
|
|
}, true);
|
2020-09-20 05:05:57 +00:00
|
|
|
|
|
|
|
/* @license-end */
|