加载后,jQuery 淡入网站/内容?

2022-01-11 00:00:00 load jquery jquery-plugins html fade

是否有任何教程或插件可以在网站正确加载后将其淡入视野,以限制任何不和谐等,从而使内容基本流畅?

Are there any tutorials or plugins for fading a site into view once its loaded properly, to limit any jarring etc, so the content appears smoothly basically?

我想如果它只是一个特定区域会更容易,因为页眉或页脚已经被缓存,从以前的页面......

I suppose it would be easier if it was just a specific area, as a header or footer will already be cached, from previous pages...

例如带有各种缩略图的投资组合页面,它们只有在准备好后才会流畅显示.

For example a portfolio page with various thumbnails, they only appear smoothly when ready.

这个可以吗?

感谢您的帮助:)

推荐答案

是的,用 div 包装你的内容(例如 <div id="main-content">)并在你的css 把这个:

Yes, wrap your content with a div (e.g. <div id="main-content">) and in your css put this:

div#main-content { display: none; }

然后使用这个脚本.

$(document).ready(function() {
    $('#main-content').fadeIn();
});

相关文章