optimize instantiation of .pandoravideo()s

This commit is contained in:
Sanj 2012-05-15 03:17:34 +05:30
parent ff4a28b8b2
commit 0fa7ca5c71

View File

@ -250,13 +250,24 @@
(function() {
var $video;
$('.padmaVideo').hide();
/*
$('.padmaVideo').each(function() {
$(this).pandoravideo();
});
*/
$('a.padmaLink').toggle(function() {
var index = $(this).index('.padmaLink');
var $video = $('.padmaVideo').eq(index);
$video.slideDown();
if ($video.data("padmaLoaded")) {
$video.slideDown();
} else {
$video.text("Loading video...");
$video.pandoravideo({
callback: function(videoObject) {
$video.data("padmaLoaded", true);
}
});
}
}, function() {
var index = $(this).index('.padmaLink');
var $video = $('.padmaVideo').eq(index);