https://blog.sessionstack.com/how-javascript-works-tracking-changes-in-the-dom-using-mutationobserver-86adc7446401
// ========================================== get rid of body scroll:
var mutationObserver = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
console.log(mutation);
console.log(mutation.oldValue);
if (mutation.oldValue === 'search-trigger') {
document.getElementsByTagName('body')[0].classList.add('noscroll');
} else {
document.getElementsByTagName('body')[0].classList.remove('noscroll');
}
});
});
// Starts listening for changes in the '.search-trigger' HTML element
mutationObserver.observe(document.querySelector('.search-trigger'), {
attributes: true,
characterData: true,
childList: true,
subtree: true,
attributeOldValue: true,
characterDataOldValue: true
});
// ========================================== get rid of body scroll ENDS