开发者

speed optimization techniques that sites like yotube and yahoo are using

开发者 https://www.devze.com 2023-01-17 10:54 出处:网络
I\'ve be开发者_Python百科en noticing quite a few websites including YouTube and http://video.yahoo.com/, amazon and Facebook are loading content above the fold and then once you scroll down the rest i

I've be开发者_Python百科en noticing quite a few websites including YouTube and http://video.yahoo.com/, amazon and Facebook are loading content above the fold and then once you scroll down the rest is loaded. I'm not sure if it's the rendering of the content that is being delayed or if its media such as images that are being fetched when you scroll down.

Does anyone know how it is being done or how I can implement something similar?


true. They use javascript ( or jquery) to load content on scroll.

Most of the time Images as they take the maximum time in a page load.

Well there are several jQuery Plugins available out there which help you to achieve the same.

One plugin example is >>>> jQuery Lazy Load inspired by YUI ImageLoader

Or google - something like this - "jquery + lazy load plugin"

hope that helps

Regards, J'Sinh


http://api.jquery.com/scroll/

using this event handler, you check the scroll position, compare it to the document height http://api.jquery.com/height/ and if scroll position compared to the height indicates that the user is at the bottom, or near the bottom, use ajax to get more content.

Sorry for such a general answer, it's just that this needs experimenting, and writing the code would take a little while. Maybe someone else would do it, but I will just stick to this.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号