Skip to content

Commit d334cf8

Browse files
committed
minor fixes
1 parent 6a52ee2 commit d334cf8

File tree

2 files changed

+2
-32
lines changed
  • 1-js/06-advanced-functions/10-bind
  • 2-ui/3-event-details/8-onscroll/3-load-visible-img/source.view

2 files changed

+2
-32
lines changed

1-js/06-advanced-functions/10-bind/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ What if we'd like to fix some arguments, but not the context `this`? For example
279279
280280
The native `bind` does not allow that. We can't just omit the context and jump to arguments.
281281
282-
Fortunately, a helper function `partial` for binding only arguments can be easily implemented.
282+
Fortunately, a function `partial` for binding only arguments can be easily implemented.
283283
284284
Like this:
285285

2-ui/3-event-details/8-onscroll/3-load-visible-img/source.view/index.html

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -169,38 +169,8 @@ <h1>Neptune</h1>
169169
* It's enough that the top or bottom edge of the element are visible
170170
*/
171171
function isVisible(elem) {
172-
173-
let coords = elem.getBoundingClientRect();
174-
175-
let windowHeight = document.documentElement.clientHeight;
176-
177-
// top elem edge is visible OR bottom elem edge is visible
178-
let topVisible = coords.top > 0 && coords.top < windowHeight;
179-
let bottomVisible = coords.bottom < windowHeight && coords.bottom > 0;
180-
181-
return topVisible || bottomVisible;
182-
}
183-
184-
/**
185-
A variant of the test that considers the element visible if it's no more than
186-
one page after/behind the current screen.
187-
188-
function isVisible(elem) {
189-
190-
let coords = elem.getBoundingClientRect();
191-
192-
let windowHeight = document.documentElement.clientHeight;
193-
194-
let extendedTop = -windowHeight;
195-
let extendedBottom = 2 * windowHeight;
196-
197-
// top visible || bottom visible
198-
let topVisible = coords.top > extendedTop && coords.top < extendedBottom;
199-
let bottomVisible = coords.bottom < extendedBottom && coords.bottom > extendedTop;
200-
201-
return topVisible || bottomVisible;
172+
// todo: your code
202173
}
203-
*/
204174

205175
function showVisible() {
206176
for (let img of document.querySelectorAll('img')) {

0 commit comments

Comments
 (0)