ここのこのページを見ると、ほとんどの部分で機能する Youtube ギャラリーのセットアップがあることがわかります。サムネールをクリックすると動画は切り替わるが、右側のテキストがうまく切り替わらない。ビデオの後ろにテキストを読み込んでいるようで、場合によっては右側のテキストを切り替えるのに 2 回クリックする必要があります。
以下の私のjQueryを見て、誰かが問題を特定するのを手伝ってくれませんか?
ありがとう!
<script>
function replaceVideo(id) {
originalSrc = jQuery("iframe", "#" + id).attr("src");
autoPlay = originalSrc + "&autoplay=1";
jQuery("iframe", "#" + id).attr("src", autoPlay);
video = jQuery(".video-content", "#" + id).html();
text = jQuery(".video-description").html();
jQuery(".vid_desc").html(text);
jQuery(".flex-video").html(video);
jQuery("iframe", "#" + id).attr("src", originalSrc);
}
jQuery(".video-list li").click(function() {
id = jQuery(this).attr("id");
replaceVideo(id);
});
jQuery(window).load(function() {
if(window.location.search.substring(1)) {
element = window.location.search.substring(1).split('&');
if (document.getElementById(element[0])) {
document.onload = replaceVideo(element[0]);
}
}
});
</script>