Reputation: 12628
I am trying to detect if a variable - play_status - has been set or not in javascript like this..
$lg.on('afterslide', function(event, prevIndex, index){
if (play_status) {
console.log('Play Defined')
}
iframe = $('.inner .item').eq(index).find('.vimeo').get(0);
var player = $f(iframe);
player.addEvent('ready', function(index) {
player.addEvent('play', function() {
var play_status = index;
});
});
});
But when I run it for the first time (when no variable is set) then I get the following error...
Uncaught ReferenceError: play_status is not defined
Where am I going wrong?
Upvotes: 1
Views: 44
Reputation: 2671
looks like you only declared play_status when you add event play to player, so its not defined outside that scope
Upvotes: 1