jquery - How do I reference this embedded iframe from javascript -
i using squarespace (in retrospect poor idea because of difficulty of customizing code), , need able identify vimeo iframe within div can use in javascript calls. however, javascript not recognize such iframe element existing. feel either it's impossible identify iframe shoved div (by squarespace), or missing selector. or pointers appreciated.
here's iframe trying embed squarespace:
<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>
here's embedded iframe:
<div class="sqs-video-wrapper" data-load="false" data-html="<iframe src="http://player.vimeo.com/video/135481337?api=1&amp;player_id=player1&amp;wmode=opaque" width="500" frameborder="0" id="player1" class="vimeo" height="281"></iframe>" data-provider-name="" > </div>
and here 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 working"); // enable 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 + " playing!"); } function onfinish() { document.write('<style>.yui3-lightbox2-content {display: none !important;}</style>'); } }); </script>
i've taken working example of api seen in link.
Comments
Post a Comment