My website loads slow because of too many embedded videos. I'm seen where there is an image (overtop of where the video is embedded) and you click it, at which point, the embedded video is loaded. Could anyone give me some help figuring out how to do this? Maybe once you hover over the image the youtube embed if loaded? Thanks so much!
相关问题
- Views base64 encoded blob in HTML with PHP
- How to fix IE ClearType + jQuery opacity problem i
- jQuery add and remove delay
- Is there a way to play audio on a mobile browser w
- HTML form is not sending $_POST values
Just use jQuery to insert the embed code after the user clicks on the image:
Just sample code: HTML
jQuery:
If you want the video to autoplay add
?autoplay=1
to the end of the url as I did.Code without thumbnail: http://jsfiddle.net/KFcRJ/
To extract video thumbnail:
HTML:
jQuery:
Code with thumbnail: http://jsfiddle.net/89uVe/4/