Question

I basically copied the accordion example straight from the jQuery website, and it works fine with text in all browsers, however, putting my video tag and object tag (for fallback to Flash) INSIDE any of the accordion sections will no longer the video to be seen (unless you move the mouse over the blank area where the video should be, right click and select Play - it works). The poster image will not show either inside the section.

If I get rid of the accordion, then the video shows & plays fine (as HTML5 in IE9 and Flash in IE8). Clearly, this is a problem with the accordion and not my player markup.

Here's the code I'm using.

<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" /> <!-- tried this with no luck for IE8 and IE9 -->
    <title>jQuery UI Accordion - Default functionality</title>
    <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
    <script src="//code.jquery.com/jquery-1.9.1.js"></script>
    <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
    <link rel="stylesheet" href="/resources/demos/style.css">
    <script>
        $(function () {
            $("#accordion").accordion();
        });
    </script>
</head>
<body>
    <div id="accordion">
        <h3>Section 1</h3>
        <div>
            <p>
                Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer
ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit
amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut
odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.
            </p>
        </div>
        <h3>Section 2</h3>
        <div>
            Hello there!
            <video id="WebVidPlayer6" width="640" height="360" controls="controls" poster="IM/mywebsite-TacTiles-Commercial-Oct-2011.jpg" preload="metadata">
                <source src="IM/mywebsite-TacTiles-Commercial-Oct-2011.webm" type="video/webm" />
                <source src="IM/mywebsite-TacTiles-Commercial-Oct-2011.ogv" type="video/ogg" />
                <source src="IM/mywebsite-TacTiles-Commercial-Oct-2011.mp4" type="video/mp4" />
                <object type="application/x-shockwave-flash" data="im/player_flv_maxi.swf" width="640" height="360" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0">
                    <param name="movie" value="im/player_flv_maxi.swf" />
                    <param name="width" value="640px" />
                    <param name="height" value="360px" />
                    <param name="allowFullScreen" value="true" />
                    <param name="play" value="false" />
                    <param name="loop" value="false" />
                    <param name="menu" value="false" />
                    <param name="quality" value="best" />
                    <param name="scale" value="default" />
                    <param name="wmode" value="opaque" />
                    <param name="allowScriptAccess" value="sameDomain" />
                    <param name="fullScreenAspectRatio" value="landscape" />
                    <param name="FlashVars" value="configxml=flash_base_config.xml&amp;startimage=http%3a%2f%2fwww.mywebsite.com%2fim%2fmywebsite-tactiles-commercial-oct-2011.jpg&amp;flv=http%3a%2f%2fwww.mywebsite.com%2fim%2fmywebsite-tactiles-commercial-oct-2011.flv"></param>
                    <img src="im/mywebsite-tactiles-commercial-oct-2011.jpg" width="640" height="360" alt="Video" /><p>Your browser can’t play HTML5 video.<a href="im/mywebsite-tactiles-commercial-oct-2011.flv">Click Here</a> to download.</p>
                </object>
            </video>

        </div>
        <h3>Section 3</h3>
        <div>
            <p>
                Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis.
Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero
ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis
lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.
            </p>
            <ul>
                <li>List item one</li>
                <li>List item two</li>
                <li>List item three</li>
            </ul>
        </div>
        <h3>Section 4</h3>
        <div>
            <p>
                Cras dictum. Pellentesque habitant morbi tristique senectus et netus
et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in
faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia
mauris vel est.
            </p>
            <p>
                Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus.
Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
inceptos himenaeos.
            </p>
        </div>


    </div>
</body>
</html>

When viewing the page source, you can see the code is exactly the same.

(it looks like jQueryUI accordion is not fully "showing" what's in the DIV unless it is text only)

Any suggestions on how to fix this?

Was it helpful?

Solution

Found a solution. The problem is jQuery proper and the way it handles hiding/showing tags. Rather than write my own JavaScript, I found an accordion from this site: http://sandbox.scriptiny.com/javascript-accordion/index.php

It is the only accordion that plays nicely with containered items (like video & object tags) - works great on IE versions 6 and up, Firefox, Safari, Chrome, Opera. It has no dependence on jQuery (but plays nicely with jQuery)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top