Closed seejamescode closed 6 years ago
Without JS:
With JS:
I have a question for you: Do you think the JavaScript is appropriate how it is or if it should be included in a module or function?
Hmm, good question. Definitely would be nice to have it as a module, but given it's size maybe just have it be in UMD format would work out? Or even just an IIFE, to be honest. For example:
(function() {
var updateScrollbarWidth = function() {
const scrollbarWidth =
window.innerWidth - document.documentElement.clientWidth + "px";
document.documentElement.style.setProperty(
"--scrollbar-width",
scrollbarWidth
);
};
var scrollbarObserver = new MutationObserver(updateScrollbarWidth);
scrollbarObserver.observe(document.body, {
attributes: true,
childList: true,
characterData: true
});
updateScrollbarWidth();
})();
Comes after #38
Adds an optional JavaScript file included at
js/yourGrid-grid.js
. This will adjust the grid to not go behind browser scrollbars since different browsers handle thevw
unit differently. It applies to any browser that supports CSS Variables and MutationObserver.Thoughts, @joshblack?