I am having trouble trying to figure this out. What I'm trying to do is get the YouTube video id and enter 11 character identifiers in the css div specific id using jQuery. I know the thumbnail URL of any video, but I just need to change the identifier to display various thumbnails of the video.
<script> $(document).ready(function() { function(data) { videoID = data.split('www.youtube.com/v/')[1].split('&')[0]; $("#304817679").append(videoID); }); $("#304817679").replaceWith("<div id=\"304817679\" " + "style=\"background: url(http://img.youtube.com/vi/" + $.function(data) + "/0.jpg) no-repeat middle; width: 15px; height: 150px;\"></div>"); }); </script> <div id="304817679"> <div style="display: none;"> <object width="248" height="222"> <param name="movie" value="http://www.youtube.com/v/vy90n2nNRKQ&rel=0&egm=0&showinfo=0&fs=1"></param> <param name="wmode" value="transparent"></param> <param name="allowFullScreen" value="true"></param> <embed src="http://www.youtube.com/v/vy90n2nNRKQ&rel=0&egm=0&showinfo=0&fs=1" type="application/x-shockwave-flash" width="248" height="222" allowFullScreen="true" wmode="transparent"></embed> </object> </div> </div>
Trying to explain this better, I want the YouTube video ID with character 11 to be embedded in the code and put it in the thumbnail URL ( http://img.youtube.com/vi/" + function(data) + "/0.jpg" ). Which would also replace the original div ( <div id="304817679"> ).
Am I on the right track with my script?
jquery youtube
Dave
source share