Skip to content
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

Embedded samples on-demand loading #847

Closed
damyanpetev opened this issue Nov 20, 2018 · 3 comments
Closed

Embedded samples on-demand loading #847

damyanpetev opened this issue Nov 20, 2018 · 3 comments

Comments

@damyanpetev
Copy link
Member

The frame loads the entire samples app and topics with multiple samples a bit to load.
It'd be a performance improvement (especially in dev mode) if the embedded sample can load on-demand as the page is scrolled through.
Not too noticeable on production and there aren't that many topics with a lot of samples, just something that can be looked into in the future.

@tiliev
Copy link
Contributor

tiliev commented Feb 13, 2019

Please follow these steps for implementing lazy loading in a topic:

  1. Generally the first sample should not be lazily loaded. Add loading class to the sample container and onload="onSampleIframeContentLoaded(this); on the iframe.
  2. On all of the sample you'd like to load lazily, add
  • loading class to the sample container
  • lazyload class to the iframe
  • rename the src of the iframe to data-src
  • you shouldn't have onload="onSampleIframeContentLoaded(this);"

P.S. Consider automating this, e.g. using C# and Html Agility pack.

@zdrawku zdrawku assigned Aleksandyr and HristoP96 and unassigned nrobakova Feb 22, 2019
@zdrawku
Copy link
Contributor

zdrawku commented Feb 22, 2019

@Aleksandyr and @HristoP96 think of a way to automate this process for the current topic.
I am going to add a readme section about the lazy loading configuration for all upcoming topics

@HristoP96
Copy link

All the PRs related to this issue are merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants