Created
February 24, 2017 12:43
-
-
Save Jan-Ka/48a151e4b99df5e63512e73e1fcffbf1 to your computer and use it in GitHub Desktop.
Revisions
-
Jan-Ka created this gist
Feb 24, 2017 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ (function () { console.log("maxWidth test running"); // in calling HTML - ensure that a div with id jsTest is available let maxWidthDiv = document.querySelector("#jsTest"); let maxWidthVal = "1337px"; if(Number.MAX_SAFE_INTEGER) { maxWidthVal = Number.MAX_SAFE_INTEGER.toString() + "px"; } else { maxWidthVal = Number.MAX_VALUE.toString() + "px"; } maxWidthDiv.style.width = maxWidthVal; // IE11 wines about String Interpolation // console.log(`element #jsTest is now set to a width of ${Number.MAX_SAFE_INTEGER}px`); console.log("element #jsTest is now set to a width of " + maxWidthVal); let lastKnownScrollPosition = 0; let ticking = false; window.addEventListener("scroll", function () { lastKnownScrollPosition = window.pageXOffset; if (!ticking) { window.requestAnimationFrame(function () { // console.log(`scrolled to: ${lastKnownScrollPosition}px`); console.log("scrolled to: " + lastKnownScrollPosition.toString() + "px"); ticking = false; }); } ticking = true; }); })();