S
S
Space2015-10-05 05:55:43
css
Space, 2015-10-05 05:55:43

How to make a page appear smoothly?

It would be desirable that when loading the page - all elements smoothly appeared or the page seemed to pop up. How is this implemented, please?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
H
HoHsi, 2015-10-05
@ruslite

1) Get an array (or html attribute) from url to images. In this case, the browser will not download them.
2) Create an invisible img element that will serve as a preloader.
3) Bind the JQ .load method to it
4) When scrolling the page to a certain image, we pass the url of the image to the application loader.
5) As soon as he answers us, put this url in src or background-image.
You can create several preloaders, or generate them if necessary, and then delete them.
---------------
If you need something to load the entire page, then you can make a div:

.loader {
  postition: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;

  background: red;

  z-index: 99999;
}

Next, we hang the handler on the window
$(window).ready ->
  $('.loader').remove()

In this case, the site will appear only after all elements are loaded and drawn.

P
Pavel Gogolinsky, 2015-10-05
@gogolinsky

There is a plugin (it is paid).
ilyabirman.ru/projects/emerge

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question