最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Youtube video inside iframe not hiding in Safari 5.1 - Stack Overflow

programmeradmin1浏览0评论

I have 3 tabs on my site. Inside 2nd (hidden) div contains a YouTube video in an iframe. When I click on second tab(containing video) video starts playing. On click of either 1st or 3rd tab (containing images) content area still show video.Whereas it should show images for respective tabs. Video is not hiding in Safari 5.1

How can I achieve this?

CODE:: 3 tabs content (html)

<div class="view-content clearthis">
    <div id="photos">
        <div class="nav">
           <a class="hide-divs" id="prev" href="#">Prev</a><a id="next" href="#">Next</a></div>
              <div id="gallery">
                <asp:PlaceHolder ID="phRoomPhotoGallary" runat="server"></asp:PlaceHolder>
                </div>
              </div>
              <div id="video">
                <div id="pnlVideo" runat="server">
                   <iframe id="objVideo" width="667" height="344" src="<%=RoomVideoURL %>" frameborder="0" title="<%=RoomName %>" allowfullscreen></iframe>
                </div>
              </div>
              <div id="floor">
                <asp:Image ID="imgFloorPlan" runat="server" Height="344" Width="667" />
              </div>
            </div>

3 tabs

enter code here


 <ul class="clearthis">
     <li id="tabPhoto" runat="server"><a id="linkPhotoTab" class="photostab" href="#photos" title="<%=RoomName %>">PHOTOS</a></li>
     <li id="tabVideo" runat="server"><a id="linkVideoTab" href="#video" title="<%=RoomName %>">VIDEO</a></li>
     <li id="tabFloor" runat="server" style="margin-right: 0px;"><a id="linkFloorTab"                                  href="#floor" title="<%=RoomName %>">FLOOR PLAN</a></li>
 </ul>

I have 3 tabs on my site. Inside 2nd (hidden) div contains a YouTube video in an iframe. When I click on second tab(containing video) video starts playing. On click of either 1st or 3rd tab (containing images) content area still show video.Whereas it should show images for respective tabs. Video is not hiding in Safari 5.1

How can I achieve this?

CODE:: 3 tabs content (html)

<div class="view-content clearthis">
    <div id="photos">
        <div class="nav">
           <a class="hide-divs" id="prev" href="#">Prev</a><a id="next" href="#">Next</a></div>
              <div id="gallery">
                <asp:PlaceHolder ID="phRoomPhotoGallary" runat="server"></asp:PlaceHolder>
                </div>
              </div>
              <div id="video">
                <div id="pnlVideo" runat="server">
                   <iframe id="objVideo" width="667" height="344" src="<%=RoomVideoURL %>" frameborder="0" title="<%=RoomName %>" allowfullscreen></iframe>
                </div>
              </div>
              <div id="floor">
                <asp:Image ID="imgFloorPlan" runat="server" Height="344" Width="667" />
              </div>
            </div>

3 tabs

enter code here


 <ul class="clearthis">
     <li id="tabPhoto" runat="server"><a id="linkPhotoTab" class="photostab" href="#photos" title="<%=RoomName %>">PHOTOS</a></li>
     <li id="tabVideo" runat="server"><a id="linkVideoTab" href="#video" title="<%=RoomName %>">VIDEO</a></li>
     <li id="tabFloor" runat="server" style="margin-right: 0px;"><a id="linkFloorTab"                                  href="#floor" title="<%=RoomName %>">FLOOR PLAN</a></li>
 </ul>
Share Improve this question edited Nov 27, 2013 at 6:07 Tepken Vannkorn 9,72314 gold badges62 silver badges86 bronze badges asked May 22, 2012 at 10:52 SnehaSneha 411 silver badge3 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 19

I've seen some pretty ridiculous answers about attempting to fix this problem in Safari. Instead, try adding:

"wmode=opaque"

as the first GET variable in the url for the youtube video.

(eg: src="http://www.youtube./embed/pPBLF2Ffbaw?wmode=opaque&rel=0")

Worked for me in a similar situation.

发布评论

评论列表(0)

  1. 暂无评论