Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Per hand geschrieben, garantiere keine 100% tige Richtigkeit
- let width = document.getElementById("width");
- let hight = document.getElementById("height");
- let action = document.getElementById("actions");
- let delay = 250;
- let throttled = false;
- action = 0;
- //unnötige scheiße die vorrausgestezt ist .....
- function getDimensions() {
- width.innerHTML = window.innerWidth;
- hight.innerHTML = window.innerHeight;
- action += 1;
- actions.innerHTML = action;
- }
- //sobald das fenster die größe ändert, führe aus:
- window.addEventListener('resize', function() {
- if (!throttled) {
- getDimensions(); // muss da ahin
- // was du machen willst hier hin
- if([width / height] [< / > / <= / ==] [WERT]){
- document.getElementById("wat weg soll").style.width = "0px"; // Zum verschwinden einfach width und hight auf null setzten
- document.getElementById("wat weg soll").style.height = "0px";
- }
- //----------------
- throttled = true; // must be ... einfach hinschreiben und net fragen
- setTimeout(function() { //falls ein fehler kommt.... muss da hin
- throttled = false;
- }, delay);
- }
- });
Add Comment
Please, Sign In to add comment