I'm working with a script to pull videos from vimeo.com through the API. The script works and pulls in all the videos... into one large unordered list (ul). I need to style the video titles into three's... so it would be best to have a ul between each 3 li's. I can add a class name by adding a tag to the video and pulling it in ({tags} pulls GROUP1 which i use to set as a class for 3 of the videos}
When i try to use jQuery to find the three LI's with the div class of 'GROUP1' and wrap them in their own UL via .wrapAll... it doesn't work! Any Ideas????
See code:
Code:
function buildLevel1Videos(albumset) {
videosUrl = 'http://www.vimeo.com/api/v2/user2109850/videos.json?callback=?'
template = "<div class='{tags}'><li><a href='javascript:void(0);' class='video-link'>{title}</a></li></div>";
containerLevel1 = $('#thumbs');
videoList = [];
userVideos = [];
$.getJSON('videos.php', function(data){
$.each(data.videos, function(i, video){
userVideos.push(video.videoid);
});
});
$.getJSON(videosUrl, function(data) {
var thumbs = $('<ul class="vset"></ul>')
$.each(data, function(i, video){
$('.GROUP1').wrapAll("<div class='omk'></div>");
thumbs.append($.nano(template, video));
videoList.push(video.id);
});
containerLevel1.html(thumbs);
videosToWatch = $.grep(videoList, function(videoId, index){
return $.inArray(videoId, userVideos) == -1
});
$.each(videosToWatch, function(i,videoId){
if(i > 0){
//$('#'+videoId).parent('a').addClass('disabled');
$('#'+videoId).parent('a').animate({opacity:0.2});
}
else {
userVideos.push(videoId);
}
});
Last edited by alexjames01; 08-27-2009 at 10:08 PM..
|