Здравствуйте уважаемые. Проблема с загрузкой скрипта при повторном открытии popup. В общем есть такое изобретение в нем вызывается popup:
function show_video_info(url) {
var dom = {'wrapper' : null, 'body':null, 'head':null, 'title':null, 'loading':null, 'content':null};
dom.wrapper = $('<div class="dialog_gallery"></div>');
dom.body = $('<div class="dialog_gallery_dialog_body __active __ready"></div>');
dom.content = $('<div class="dialog_gallery_dialog_content"></div>');
var loading = $('<div class="dialog_gallery_dialog_loading"><div class="dialog_gallery_dialog_loading_text"></div></div>');
$(dom.content).html(loading);
setTimeout(function() {
$('.dialog_gallery_dialog_loading').remove();
$.get(url, function(data){
$(dom.content).html(data);
});
},1000);
$(dom.body).append(dom.content);
$(dom.wrapper).append(dom.body).append('<div style="clear:both; display:block;"></div>');
$(document.body).append(dom.wrapper);
$("html,body").css("overflow","hidden");
}
А в этом содержимое:
<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL;?>/js/jquery.js"></script>
<link rel="stylesheet" href="<?php echo RESOURCE_SITE_URL;?>/js/video/css/elite.css" type="text/css" media="screen"/>
<link rel="stylesheet" href="<?php echo RESOURCE_SITE_URL;?>/js/video/css/elite-font-awesome.css" type="text/css">
<link rel="stylesheet" href="<?php echo RESOURCE_SITE_URL;?>/js/video/css/jquery.mCustomScrollbar.css" type="text/css">
<script src="<?php echo RESOURCE_SITE_URL;?>/js/video/js/froogaloop.js" type="text/javascript"></script>
<script src="<?php echo RESOURCE_SITE_URL;?>/js/video/js/jquery.mCustomScrollbar.js" type="text/javascript"></script>
<script src="<?php echo RESOURCE_SITE_URL;?>/js/video/js/THREEx.FullScreen.js"></script>
<script src="<?php echo RESOURCE_SITE_URL;?>/js/video/js/videoPlayer.js" type="text/javascript"></script>
<script src="<?php echo RESOURCE_SITE_URL;?>/js/video/js/Playlist.js" type="text/javascript"></script>
<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL;?>/js/video/js/ZeroClipboard.js"></script>
<script type="text/javascript" charset="utf-8">
$(function(){
videoPlayer = $("#video_box").Video({ //ALL PLUGIN OPTIONS
instanceName:"player1", //name of the player instance
autohideControls:2, //autohide HTML5 player controls
hideControlsOnMouseOut:"No", //hide HTML5 player controls on mouse out of the player: "Yes","No"
videoPlayerWidth:1026,
videoPlayerHeight:500,
responsive:true,
playlist:"Right playlist",
playlistScrollType:"3d",
playlistBehaviourOnPageload:"opened",
autoplay:true,
colorAccent:"#cc181e",
vimeoColor:"00adef",
youtubeControls:"custom controls",
youtubeSkin:"dark",
youtubeColor:"red",
youtubeQuality:"default",
videoPlayerShadow:"effect1",
loadRandomVideoOnStart:"No",
shuffle:"No",
posterImg:"<?php echo $output['video_info']['iurlmaxres'];?>",
onFinish:"Play next video",
nowPlayingText:"No",
fullscreen:"Fullscreen native",
rightClickMenu:true,
hideVideoSource:false,
showAllControls:true,
allowSkipAd:true,
infoShow:"Yes",
shareShow:"No",
facebookShow:"No",
twitterShow:"No",
mailShow:"No",
facebookShareName:"Elite video player",
facebookShareLink:"",
facebookShareDescription:"Elite Video Player is stunning, modern, responsive, fully customisable high-end video player for WordPress that support advertising and the most popular video platforms like YouTube, Vimeo or self-hosting videos (mp4).", //third parametar of facebook share in facebook feed dialog is description below link
facebookSharePicture:"",
twitterText:"Elite video player",
twitterLink:"",
twitterHashtags:"wordpressvideoplayer",
twitterVia:"Creative media",
googlePlus:"",
logoShow:"Yes",
logoClickable:"Yes",
logoPath:"<?php echo RESOURCE_SITE_URL;?>/js/video/images/logo/logo.png",
logoGoToLink:"http://kadamas.ru",
logoPosition:"bottom-left",
embedShow:"No",
embedCodeSrc:"kadamas.ru",
embedCodeW:"746",
embedCodeH:"420",
embedShareLink:"kadamas.ru",
youtubePlaylistID:"",
youtubeChannelID:"",
//manual playlist
videos:[
{
videoType:"youtube",
title:"<?php echo $output['video_info']['video_name'];?>",
youtubeID:"<?php echo $output['video_info']['original_video_id'];?>",
vimeoID:"",
mp4:"",
imageUrl:"<?php echo $output['video_info']['iurlmaxres'];?>",
imageTimer:4,
prerollAD:"no",
prerollGotoLink:"",
preroll_mp4:"",
prerollSkipTimer:5,
midrollAD:"no",
midrollAD_displayTime:"00:10",
midrollGotoLink:"",
midroll_mp4:"",
midrollSkipTimer:5,
postrollAD:"no",
postrollGotoLink:"",
postroll_mp4:"",
postrollSkipTimer:5,
popupImg:"",
popupAdShow:"no",
popupAdStartTime:"00:03",
popupAdEndTime:"00:07",
popupAdGoToLink:"",
description:"",
thumbImg:"<?php echo $output['video_info']['thumbnail_url'];?>",
info:"<?php echo $output['video_info']['video_name'];?>"
},
]
});
});
</script>
<div class="dialog_gallery_dialog_head"><span class="dialog_gallery_dialog_title"><span class="dialog_gallery_dialog_title_icon"><span id="close_gallery" class="dialog_gallery_dialog_close_button" title="Закрыть просмотр"></span></span></span></div>
<div id="pictureFolder" class="album">
<div id="modal_overlay"></div>
<div class="ad-gallery __animated">
<div id="video_box"></div>
</div>
</div>
<script type="text/javascript">
$(function(){
$('.dialog_gallery_dialog_close_button').click(function(){
if($('#video_player').length == 1){
$("html,body").css("overflow","auto");
}
$(this).parents('.dialog_gallery').remove();
});
});
</script>
При первом открытии все срабатывает отлично, но при закрытии и повторном открытии без перезагрузки страницы скрипт не загружает видео. Подскажите в чем причина и как ее исправить?! Может как то нужно обнулять функцию videoPlayer = $("#video_box").Video({