From cfaf1275a7a7a960d61404fdc92129a9c19e6987 Mon Sep 17 00:00:00 2001 From: Usman Khalid Date: Mon, 21 Oct 2013 20:39:59 +0500 Subject: [PATCH] leanModel is setup on jQuery.ready() --- lms/static/js/toggle_login_modal.js | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/lms/static/js/toggle_login_modal.js b/lms/static/js/toggle_login_modal.js index df62a01505..063da6998e 100644 --- a/lms/static/js/toggle_login_modal.js +++ b/lms/static/js/toggle_login_modal.js @@ -87,17 +87,19 @@ } }); - $("a[rel*=leanModal]").each(function(){ - $(this).leanModal({ top : 120, overlay: 1, closeButton: ".close-modal", position: 'absolute' }); - embed = $($(this).attr('href')).find('iframe') - if(embed.length > 0) { - if(embed.attr('src').indexOf("?") > 0) { - embed.data('src', embed.attr('src') + '&autoplay=1&rel=0'); - embed.attr('src', ''); - } else { - embed.data('src', embed.attr('src') + '?autoplay=1&rel=0'); - embed.attr('src', ''); - } - } + $(document).ready(function($) { + $("a[rel*=leanModal]").each(function(){ + $(this).leanModal({ top : 120, overlay: 1, closeButton: ".close-modal", position: 'absolute' }); + embed = $($(this).attr('href')).find('iframe') + if(embed.length > 0) { + if(embed.attr('src').indexOf("?") > 0) { + embed.data('src', embed.attr('src') + '&autoplay=1&rel=0'); + embed.attr('src', ''); + } else { + embed.data('src', embed.attr('src') + '?autoplay=1&rel=0'); + embed.attr('src', ''); + } + } + }); }); })(jQuery);