PDA

View Full Version : LazyLoad Youtube BB Code


NukedLT
03-05-2014, 12:12 AM
I've got a number of threads that are predominantly videos, for example a 'Movie Trailers' thread I have the board automatically post to from a youtube RSS feed. It doesn't take many before it starts to crawl. Wrapping them in 'spoiler' tags help, but it's an ugly workaround.

I've got a lazyload concept working, but I'm not too familiar with jquery/javascript and it's very simplistic.

http://www.landthieves.com/board/showthread.php?70130

A single div with the dimensions of the player and the youtube thumbnail set as the background. Clicking the div fires the jquery .html() to insert the youtube iframe which autoplays.

jfiddle: http://jsfiddle.net/9t2q7/13/

I know inline script is frowned upon, especially when redundant, but I'm using the {param} to give the div a unique ID on top of the embed/thumbnail.

Is there a more efficient way of doing this?

charlesr
01-25-2017, 06:34 AM
Is there a more efficient way of doing this?

Did you get any further with this?