$(document).ready(function() {
var playing = playing;
if(playing === undefined || playing === null)
playing = false;
// Store the window width
var windowWidth = $(window).width();
// Resize Event
$(window).resize(function(){
alert(playing);
if(!playing) {
// Check window width has actually changed and it's not just iOS triggering a resize event on scroll
if ($(window).width() != windowWidth) {
// Update the window width for next time
windowWidth = $(window).width();
location.reload();
}
}
// Otherwise do nothing
});
});
And i'm using this code in one page to check if you tube is clicked on full screen, if yes stop resizing else resize windows
function onYouTubeIframeAPIReady() {
$('.MovieTrailer').each(function() {
var frame = $(this);
//create each instance using the individual iframe id
var player = new YT.Player(frame.attr('id'), {
events: {
'onStateChange': function(e) {
playing = true;
if (e.data == YT.PlayerState.PLAYING)
playing = true;
if (e.data == YT.PlayerState.PAUSED)
playing = false;
function reload_js(src) {
$('script[src="' + src + '"]').remove();
$('<script>').attr('src', src).appendTo('head');
}
reload_js('resize.js');
}
}
});
});
}
But the problem is the playing is always get back to false and if i remove
var playing = playing; if(playing === undefined || playing === null) playing = false;
From the first script file the page give error which is playing is not defined how can i define playing and changed it status
This post has been edited by Desertt: 12 August 2016 - 06:35 AM

New Topic/Question
Reply


MultiQuote



|