0

我正在使用 gdata 播放列表提要来抓取播放列表中的所有视频以在我的网站上显示。这是使用 gdata 播放列表提要的 javascript 函数。我想在单击链接时将播放列表 id 替换为另一个播放列表 id,以便视频也被替换。

$(function() {
$('#ytVideoGallery').ytVideoGallery({
    feedUrl: 'http://gdata.youtube.com/feeds/api/playlists/9EA41FFD2282B969',
       playerOptions: {
        rel: '0',
        wmode: 'opaque'
       },
      playerWidth: 640,
      playerHeight: 360
   }); 
});
4

1 回答 1

0

您可以将选项保存到 var 中。

   var options = {
    feedUrl: 'http://gdata.youtube.com/feeds/api/playlists/9EA41FFD2282B969',
       playerOptions: {
        rel: '0',
        wmode: 'opaque'
       },
      playerWidth: 640,
      playerHeight: 360
   };

$(function() {
  $('#ytVideoGallery').ytVideoGallery(options);
});

单击后,您可以将其附加到另一个元素:

$("#some_element").click(function(){
  $(this).ytVideoGallery(options);
  $('#ytVideoGallery').remove(); // You can remove previous element.
});
于 2013-08-12T05:33:42.267 回答