0

Hey Guys

What i want is, to show a pop up or a simple div or a modal or any dialogue box to to load on my home page to show welcome message, whats new etc stuff, which will be displayed only once in a day to every visitor of my site,(at the first visit of the day only ) But i want to load this modal after a sec when all the other elements of the pages have been finished loading.
I have seen this kind of thing on other websites but have no idea of how to do that, Any expert with related idea out there?

Thanks in advance.

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by kiamzattu
0

The browser loads the java script when it encounters the script tag. So you can place the script tag after all the elements in the page is loaded.
<body>
your content
<script ..../>
</body>

But it is considered a good practice to place scripts in the head tag. So if you are not allowed to place it after the body tag, use the defer attribute in the script tag.
<script type="text/javascript" defer>
your script goes here
</script>
This effectively 'stops' loading the javascript until all the elements in the page are loaded. You can read more about 'defer' here

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.