Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (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;
- });
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement