Skip to content

Commit

Permalink
fix images on user profile
Browse files Browse the repository at this point in the history
  • Loading branch information
ascott committed Feb 5, 2020
1 parent 5b3437e commit 9d6a536
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
10 changes: 2 additions & 8 deletions public/js/home-search-view.js
@@ -1,21 +1,15 @@
import "lazysizes";
import map from "./map.js";
import tabsWithCards from "./tabs-with-cards.js";
import bookmarkButtons from "./bookmark-buttons.js";
import dropdownButton from "./dropdown-button.js";
import searchFilters from "./search-filters.js";
import lazyLoadImages from "./lazy-load-images.js";

document.addEventListener("DOMContentLoaded", () => {
map.init();
tabsWithCards.init();
bookmarkButtons.init();
dropdownButton.init();
searchFilters.init();

document.addEventListener("lazybeforeunveil", e => {
const bgUrl = e.target.getAttribute("data-bg");
if (bgUrl) {
e.target.style.backgroundImage = `url(${bgUrl})`;
}
});
lazyLoadImages.init();
});
14 changes: 14 additions & 0 deletions public/js/lazy-load-images.js
@@ -0,0 +1,14 @@
import "lazysizes";

const lazyLoadImages = {
init() {
document.addEventListener("lazybeforeunveil", e => {
const bgUrl = e.target.getAttribute("data-bg");
if (bgUrl) {
e.target.style.backgroundImage = `url(${bgUrl})`;
}
});
}
}

export default lazyLoadImages;
2 changes: 2 additions & 0 deletions public/js/user-view.js
@@ -1,9 +1,11 @@
import tabsWithCards from "./tabs-with-cards.js";
import bookmarkButtons from "./bookmark-buttons.js";
import dropdownButton from "./dropdown-button.js";
import lazyLoadImages from "./lazy-load-images.js";

document.addEventListener("DOMContentLoaded", () => {
tabsWithCards.init();
bookmarkButtons.init();
dropdownButton.init();
lazyLoadImages.init();
});

0 comments on commit 9d6a536

Please sign in to comment.