I'm trying to load Topup in a getScript function, which works fine.
My problem comes when I try to define my images and players path. If those are inside any function (like a document ready), everything seems to blow up.
Here's exactly what I'm trying to do:
$(document).ready(function() {
var $vids = $('a[href$=.mov], a[href$=.flv]');
if (! $vids.length) { return; }
$.getScript('/assets/scripts/topup/top_up.js', function(){
TopUp.images_path = "/assets/scripts/topup/images/top_up/";
TopUp.players_path = "/assets/scripts/topup/players/";
$vids.attr('toptions', 'width=600, height=400, overlayClose=1, layout=quicklook, effect=clip');
});
});
I can't define TopUp.images_path and TopUp.players_path outside of the function, because topup isn't loaded yet so TopUp is not defined. But if I do it inside the function it doesn't work.
I'm trying to load Topup in a getScript function, which works fine.
My problem comes when I try to define my images and players path. If those are inside any function (like a document ready), everything seems to blow up.
Here's exactly what I'm trying to do: $(document).ready(function() { var $vids = $('a[href$=.mov], a[href$=.flv]'); if (! $vids.length) { return; } $.getScript('/assets/scripts/topup/top_up.js', function(){ TopUp.images_path = "/assets/scripts/topup/images/top_up/"; TopUp.players_path = "/assets/scripts/topup/players/"; $vids.attr('toptions', 'width=600, height=400, overlayClose=1, layout=quicklook, effect=clip'); }); });
I can't define TopUp.images_path and TopUp.players_path outside of the function, because topup isn't loaded yet so TopUp is not defined. But if I do it inside the function it doesn't work.
Any tips?