Skip to content

Trigger on page load or on scroll #166

Answered by Flyer53
4goodapp asked this question in Q&A
Discussion options

You must be logged in to vote

Hi there

Sure, for the page load you could use

window.addEventListener('load', (event) => {
  console.log('page is fully loaded');
  jsPanel.create();
});

To add a 5 sec delay just wrap the function creating the panel in a setTimeout like

window.addEventListener('load', (event) => {
  console.log('page is fully loaded');
  window.setTimeout(function(){
    jsPanel.create();
  }, 5000);
});

Take a look at:
https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event
https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout

For scrolling it's basically the same. Look at:
https://developer.mozilla.org/en-US/docs/Web/API/Document/scroll_event
https://develope…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@4goodapp
Comment options

@4goodapp
Comment options

@Flyer53
Comment options

@4goodapp
Comment options

Answer selected by 4goodapp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants