Merge pull request #2877 from lidlanca/patch-8

Fix: Set title for multiple youtube video player with the same ID  (dont rely on id to set title)
This commit is contained in:
Sam 2014-10-15 12:23:44 +11:00
commit 32a8b1b4ed
1 changed files with 4 additions and 2 deletions

View File

@ -34,8 +34,10 @@
.html('<p id="lazyYT-title-' + id + '" class="lazyYT-title"></p><div class="lazyYT-button"></div>') .html('<p id="lazyYT-title-' + id + '" class="lazyYT-title"></p><div class="lazyYT-button"></div>')
.addClass('lazyYT-image-loaded'); .addClass('lazyYT-image-loaded');
var $el_title = $el.find("p.lazyYT-title"); //get reference to the current container title element
$.getJSON('https://gdata.youtube.com/feeds/api/videos/' + id + '?v=2&alt=json', function (data) { $.getJSON('https://gdata.youtube.com/feeds/api/videos/' + id + '?v=2&alt=json', function (data) {
$('#lazyYT-title-' + id).text(data.entry.title.$t); $el_title.text(data.entry.title.$t);
}); });
$el.on('click', function (e) { $el.on('click', function (e) {