Skip to content
This repository has been archived by the owner on Jan 22, 2022. It is now read-only.

Commit

Permalink
feat: lazyload images on scroll
Browse files Browse the repository at this point in the history
See #4
  • Loading branch information
coderbyheart committed Mar 18, 2020
1 parent 1c01427 commit 2b07f05
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/BasicGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ export const ConferenceItem = ({ conference }) => (
{conference.image && (
<Cover
aspectRatio={2 / 1}
style={{ backgroundImage: `url(${conference.image})` }}
className="lazyload"
data-bg={conference.image}
/>
)}
{!conference.image ? <Placeholder aspectRatio={2 / 1} /> : ''}
Expand Down
10 changes: 10 additions & 0 deletions src/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ export default function HTML(props) {
{props.postBodyComponents}
<script src="https://unpkg.com/feather-icons"></script>
<script>feather.replace();</script>
<script
async
src="https://afarkas.github.io/lazysizes/lazysizes.min.js"
crossorigin="anonymous"
></script>
<script
async
src="https://afarkas.github.io/lazysizes/plugins/unveilhooks/ls.unveilhooks.min.js"
crossorigin="anonymous"
></script>
</body>
</html>
)
Expand Down

0 comments on commit 2b07f05

Please sign in to comment.