diff --git a/2-ui/1-document/09-size-and-scroll/1-get-scroll-height-bottom/solution.md b/2-ui/1-document/09-size-and-scroll/1-get-scroll-height-bottom/solution.md index 01e073655..ca46f79e3 100644 --- a/2-ui/1-document/09-size-and-scroll/1-get-scroll-height-bottom/solution.md +++ b/2-ui/1-document/09-size-and-scroll/1-get-scroll-height-bottom/solution.md @@ -1,7 +1,8 @@ -The solution is: +Løsningen er: ```js let scrollBottom = elem.scrollHeight - elem.scrollTop - elem.clientHeight; ``` -In other words: (full height) minus (scrolled out top part) minus (visible part) -- that's exactly the scrolled out bottom part. +Eller med andre ord: (fuld højde) minus (ud-scrollet top del) minus (synlig del) = den ud-scrollede bund del. + diff --git a/2-ui/1-document/09-size-and-scroll/1-get-scroll-height-bottom/task.md b/2-ui/1-document/09-size-and-scroll/1-get-scroll-height-bottom/task.md index 796039c2a..6f833bae9 100644 --- a/2-ui/1-document/09-size-and-scroll/1-get-scroll-height-bottom/task.md +++ b/2-ui/1-document/09-size-and-scroll/1-get-scroll-height-bottom/task.md @@ -2,10 +2,10 @@ importance: 5 --- -# What's the scroll from the bottom? +# Hvad er scroll fra bunden? -The `elem.scrollTop` property is the size of the scrolled out part from the top. How to get the size of the bottom scroll (let's call it `scrollBottom`)? +Egenskaben `elem.scrollTop` viser den del af indholdet, der er scroll'et ud fra toppen. Hvordan får man størrelsen på den del af indholdet, der er scroll'et ud fra bunden (lad os kalde den `scrollBottom`)? -Write the code that works for an arbitrary `elem`. +Skriv en kode der virker for et vilkårligt element. -P.S. Please check your code: if there's no scroll or the element is fully scrolled down, then it should return `0`. +P.S. Tjek din kode: hvis der ikke er nogen scroll eller elementet er fuldt scroll'et ud, så skal den returnere `0`. diff --git a/2-ui/1-document/09-size-and-scroll/2-scrollbar-width/solution.md b/2-ui/1-document/09-size-and-scroll/2-scrollbar-width/solution.md index 1ba1e5e57..44781265b 100644 --- a/2-ui/1-document/09-size-and-scroll/2-scrollbar-width/solution.md +++ b/2-ui/1-document/09-size-and-scroll/2-scrollbar-width/solution.md @@ -1,16 +1,16 @@ -To get the scrollbar width, we can create an element with the scroll, but without borders and paddings. +For at få bredden på en scrollbjælke kan vi oprette et element med scroll, men uden rammer og padding. -Then the difference between its full width `offsetWidth` and the inner content area width `clientWidth` will be exactly the scrollbar: +Forskellen mellem dets fulde bredde `offsetWidth` og den indre indholdsarealbredde `clientWidth` vil være præcis scrollbjælken: ```js run -// create a div with the scroll +// Opret et div element med scroll let div = document.createElement('div'); div.style.overflowY = 'scroll'; div.style.width = '50px'; div.style.height = '50px'; -// must put it in the document, otherwise sizes will be 0 +// Vi skal indsætte elementet i dokumentet, ellers vil dimensionerne være 0 document.body.append(div); let scrollWidth = div.offsetWidth - div.clientWidth; diff --git a/2-ui/1-document/09-size-and-scroll/2-scrollbar-width/task.md b/2-ui/1-document/09-size-and-scroll/2-scrollbar-width/task.md index b39004cbf..c37eb0621 100644 --- a/2-ui/1-document/09-size-and-scroll/2-scrollbar-width/task.md +++ b/2-ui/1-document/09-size-and-scroll/2-scrollbar-width/task.md @@ -2,10 +2,10 @@ importance: 3 --- -# What is the scrollbar width? +# Hvad er bredden på en scrollbjælke? -Write the code that returns the width of a standard scrollbar. +Skriv koden der returnerer bredden på en standard scrollbjælke. -For Windows it usually varies between `12px` and `20px`. If the browser doesn't reserve any space for it (the scrollbar is half-translucent over the text, also happens), then it may be `0px`. +For Windows varierer den normalt mellem `12px` og `20px`. Hvis browseren ikke reserverer plads til den (scrollbjælken er halvt gennemsigtig over teksten, hvilket også sker), kan den være `0px`. -P.S. The code should work for any HTML document, do not depend on its content. +P.S. Koden skal virke for et vilkårligt HTML dokument og må ikke afhæng af dets indhold. diff --git a/2-ui/1-document/09-size-and-scroll/4-put-ball-in-center/ball-half/index.html b/2-ui/1-document/09-size-and-scroll/4-put-ball-in-center/ball-half/index.html index 8f855ecfa..d9e09dcb5 100755 --- a/2-ui/1-document/09-size-and-scroll/4-put-ball-in-center/ball-half/index.html +++ b/2-ui/1-document/09-size-and-scroll/4-put-ball-in-center/ball-half/index.html @@ -20,8 +20,11 @@