New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scrolling #224
Scrolling #224
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
и там еще есть файлы в папках view - там тоже могут быть англ. тексты.
Please make the requested changes. After it, add a comment "/done". |
@xcurveballx по поводу папок view. Имеет тут смысл заменить куски из английской на куски из русской? Там они правда немного по другому сконструированы, но, думаю, этот тут не особо важно. Просто вставить максимально аналогичные абзацы. |
@rkonkin да, я думаю можно вставить аналогичный текст с вики, ну и + скрипт |
// disable caching | ||
// this line should be removed in production code | ||
// отключение кэширования | ||
// эта строка должна быть удалена в "боевом" коде |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тут большие сомнения на счет правильного перевода production code
.
Перевел как "боевой" код. Норм?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
как вариант, можно написать "в окончательной версии кода" или по-простому "на проде".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
в окончательной версии кода
Так наверно будет не совсем очевидно, что значит "окончательная версия".
на проде
Я приблизительно так и хотел сначала, но потом подумал, что тем, кто еще не работал нигде разработчиком, это будет каким-то неизвестным термином. Мне показалось, что "боевой" - более-менее понятное слово для всех.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
да, можно и так оставить - я заапрувил.
/done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Спасибо, пожалуйста, внеси изменения. В основном улучшения изложения.
@@ -1,65 +1,65 @@ | |||
The core of the solution is a function that adds more dates to the page (or loads more stuff in real-life) while we're at the page end. | |||
Суть решения -- это функция, которая добавляет больше дат на страницу (или загружает больше материала в реальной жизни), пока мы находимся в конце этой страницы. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Основа решения -- функция, которая добавляет больше дат на страницу (или загружает больше материала в реальной жизни), пока мы находимся в конце этой страницы.
|
||
The document is represented (and contained) within `<html>` tag, that is `document.documentElement`. | ||
Документ представлен (и содержится) в теге `<html>`, то есть `document.documentElement`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Документ представлен тегом <html>
(и содержится в нём же) , который доступен как document.documentElement
.
|
||
We can get window-relative coordinates of the whole document as `document.documentElement.getBoundingClientRect()`. And the `bottom` property will be window-relative coordinate of the document end. | ||
Мы можем получить координаты относительно окна так `document.documentElement.getBoundingClientRect()`. И свойство `bottom` будет координатой относительно окна для конца документа. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Мы можем получить координаты относительно окна как document.documentElement.getBoundingClientRect()
. И свойство bottom
будет координатой конца документа (относительно окна).
|
||
P.S. The solution also has a variant of `isVisible` that "pre-loads" images that are within 1 page above/below (the page height is `document.documentElement.clientHeight`). | ||
P.S. У этого решения также есть вариант `isVisible`, который предварительно загружает изображения, находящиеся в пределах одной страницы выше/ниже (высота страницы -- `document.documentElement.clientHeight`). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P.S. В решении этой задачи есть также вариант isVisible
, который предварительно загружает изображения, находящиеся в пределах одной страницы выше/ниже (высота страницы -- document.documentElement.clientHeight
).
|
||
```html | ||
<img *!*src="placeholder.svg"*/!* width="128" height="128" *!*data-src="real.jpg"*/!*> | ||
``` | ||
|
||
So, initially all images are `placeholder.svg`. When the page scrolls to the position where the user can see the image -- we change `src` to the one in `data-src`, and so the image loads. | ||
Итак, изначально все изображения -- `placeholder.svg`. Когда страница прокручивается до того положения, где пользователь может увидеть изображение -- мы меняем `src` на значение из `data-src`, и таким образом изображение загружается. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
То есть, изначально, все изображения - ...
|
||
Scroll events allow to react on a page or element scrolling. There are quite a few good things we can do here. | ||
События прокрутки позволяют реагировать на прокрутку страницы или элемента. Есть немало хороших вещей, которые можно сделать. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Есть немало хороших вещей, которые можно сделать. -> Есть много хороших вещей, которые можно сделать при этом.
|
||
But we can prevent scrolling by `event.preventDefault()` on an event that causes the scroll. | ||
Но можно предотвратить прокрутку, используя `event.preventDefault()` на событии, которое вызывает её. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
, которое вызывает прокрутку.
- `wheel` event -- a mouse wheel roll (a "scrolling" touchpad action generates it too). | ||
- `keydown` event for `key:pageUp` and `key:pageDown`. | ||
Например: | ||
- Событие `wheel` -- прокрутка колеса мыши ("прокручивание" тачпада также его генерирует). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- На событии...
- `keydown` event for `key:pageUp` and `key:pageDown`. | ||
Например: | ||
- Событие `wheel` -- прокрутка колеса мыши ("прокручивание" тачпада также его генерирует). | ||
- Событие `keydown` для клавиш `key:pageUp` и `key:pageDown`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- На событии...
|
||
Sometimes that may help. But there are more ways to scroll, so it's quite hard to handle all of them. So it's more reliable to use CSS to make something unscrollable, like `overflow` property. | ||
Иногда это может помочь. Но есть и другие способы прокрутки, то есть достаточно сложно учесть все возможные варианты. Более надёжный способ -- использовать CSS, чтобы сделать что-то непрокручиваемым, например, свойство `overflow`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Если поставить на них обработчики, в которых вызвать event.preventDefault()
, то прокрутка не начнётся.
Иногда это может помочь, но более надёжный способ -- использовать CSS, чтобы сделать что-то непрокручиваемым, например, свойство overflow
.
Please make the requested changes. After it, add a comment "/done". |
/done |
|
||
Sometimes that may help. But there are more ways to scroll, so it's quite hard to handle all of them. So it's more reliable to use CSS to make something unscrollable, like `overflow` property. | ||
Если поставить на них обработчики, в которых вызвать event.preventDefault(), то прокрутка не начнётся. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Если поставить на них обработчики, в которых вызвать event.preventDefault(), то прокрутка не начнётся. | |
Если поставить на них обработчики, в которых вызвать `event.preventDefault()`, то прокрутка не начнётся. |
@@ -208,8 +208,8 @@ <h1>Neptune</h1> | |||
if (!realSrc) continue; | |||
|
|||
if (isVisible(img)) { | |||
// disable caching | |||
// this line should be removed in production code | |||
// отключение кэширования |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// отключение кэширования | |
// отключение кеширования |
@@ -208,8 +208,8 @@ <h1>Neptune</h1> | |||
if (!realSrc) continue; | |||
|
|||
if (isVisible(img)) { | |||
// disable caching | |||
// this line should be removed in production code | |||
// отключение кэширования |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// отключение кэширования | |
// отключение кеширования |
🚀 |
No description provided.