1

私はsquarespaceを使用しています(コードでのカスタマイズが難しいため、振り返ってみると悪い考えです)、このdiv内でvimeo iframeを識別できる必要があるため、いくつかのjavascript呼び出しで使用できます。ただし、javascript はそのような iframe 要素の存在を認識しません。iframe が現在 (squarespace によって) div に押し込まれているため、iframe を識別することができないか、セレクターが欠落しているように感じます。ヘルプやポインタをいただければ幸いです。

正方形スペースに埋め込もうとしている iframe は次のとおりです。

<iframe src="http://player.vimeo.com/video/135481337?api=1&player_id=player1&wmode=opaque" width="500" frameborder="0" id="player1" class="vimeo" height="281"></iframe>

埋め込まれた iframe は次のとおりです。

<div class="sqs-video-wrapper" data-load="false" data-html="&lt;iframe src=&quot;http://player.vimeo.com/video/135481337?api=1&amp;amp;player_id=player1&amp;amp;wmode=opaque&quot; width=&quot;500&quot; frameborder=&quot;0&quot; id=&quot;player1&quot; class=&quot;vimeo&quot; height=&quot;281&quot;&gt;&lt;/iframe&gt;" data-provider-name="" >
    </div>

そして、ここに私のjavascriptがあります:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>

<script src="http://a.vimeocdn.com/js/froogaloop2.min.js"></script>   
    <script type="text/javascript">

        jQuery(document).ready(function() {

            alert("this alert is working");

            // Enable the API on each Vimeo video
            jQuery('iframe.vimeo').each(function(){
                Froogaloop(this).addEvent('ready', ready);
            });

            function ready(playerID){
                Froogaloop(playerID).addEvent('play', play(playerID));
                Froogaloop(playerID).addEvent('finish', onFinish);
            }

            function play(playerID){
                alert(playerID + " is playing!");
            }

            function onFinish() {
                document.write('<style>.yui3-lightbox2-content {display: none !important;}</style>');
            }

        });
    </script>

このリンクに見られるように、この API の実例からこれを取得しました。

4

0 に答える 0