Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd lazyLoad module #540
+163
−24
Conversation
PolinaShneider
requested review from
neSpecc,
khaydarov,
talyguryn and
gohabereg
Mar 28, 2019
PolinaShneider
added some commits
Mar 28, 2019
neSpecc
requested changes
Apr 1, 2019
|
Модуль просто дописывает классы, а не осуществляет lazy load |
talyguryn
requested changes
Apr 1, 2019
| </video> | ||
| <? endif; ?> | ||
| <div class="lazy-load js_lazy-load"> | ||
| <? if (strpos($plugin['demo'], 'mp4') === false): ?> |
This comment has been minimized.
This comment has been minimized.
talyguryn
Apr 1, 2019
Member
что находится в поле demo? ссылка? а почему называется demo? но это меньшая проблема.
мало же проверять просто вхождение mp4. надо проверять наличие .mp4 в конце строки
| <img class="lazy-load__media js_lazy-media" src="<?= $plugin['demo'] ?>" alt="<?= $plugin['name'] ?>"> | ||
| <? else: ?> | ||
| <video class="lazy-load__media js_lazy-media" autoplay loop muted playsinline> | ||
| <source src="<?= $plugin['demo'] ?>" type="video/mp4"> |
This comment has been minimized.
This comment has been minimized.
talyguryn
Apr 1, 2019
Member
зачем ты сразу прописываешь src у элемента? идея в том, чтобы не задавать этот параметр сразу. тот же путь к источнику прописывается, например, в data-src, а потом с помощью js подставляется в параметр src. тем самым получается, что эти элементы не тормозят загрузку страницы
PolinaShneider
and others
added some commits
Apr 1, 2019
khaydarov
reviewed
Apr 8, 2019
| /** | ||
| * Classes used in module | ||
| */ | ||
| static get classes() { |
This comment has been minimized.
This comment has been minimized.
| */ | ||
| addLoadedClass(element) { | ||
|
|
||
| element.closest(`.${LazyLoad.classes.wrapper}`).classList.add(LazyLoad.classes.loaded); |
This comment has been minimized.
This comment has been minimized.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
PolinaShneider commentedMar 28, 2019
Lazy-loading module for images & videos