0

Hi I have a bit of code which works with Jquery and works perfectly in all browsers except ie (and it doesn t seem to work in any ie browsers -7, 8, 9). The Jquery code is as follows.. can anyone see a problem:

$(document).ready(function () {
            var obj = $('object')
     .wrap('<div id="test"></div>')
     .find('embed').attr('src', function (i, s) { return s + '&enablejsapi=1&version=3' }).end()
     .find('param[name=movie]').attr('value', function (i, v) { return v + '&enablejsapi=1&version=3' }).end()
     .detach()
     .appendTo($('#test'));

            $(document).ready(function () {
                $("#emsbinstartbutton").click(function () {
                    //Then assign the src to null, this then stops the video been playing
                    obj.find('embed')[0].pauseVideo();
                    $("body").append($("<div>").css({
                        position: "fixed"
        , width: "640px"
        , height: "425px"
        , "background-color": "#000"
        , opacity: 0.6
        , "z-index": 999
        , top: 0
        , left: 0
                    }).attr("id", "page-cover"));

                    $("#threebytwo").show();
                });
            });

This code makes a widget pop up when a user clicks a buy now button:

 $("#threebytwo").show();

Here is a jsfiddle of the whole code which you can see wokring in Firfox chrome and safari but not working in ie.

http://jsfiddle.net/M46rZ/5/

I looked this up and saw a trick where you set the meta data tag to ie 8 but i have tried this but it hasn t worked.

I think i need to read up a bit more on cross browser issues as i keeep coming across them but nay help is appreciated!

Edit Sorry to clarify what the actual problem is - when you click the buy now button there should be a pop up

Edit 2

as pointed out in one of the comments it is this line which stop the code working in ie:

obj.find('embed')[0].pauseVideo();

Thanks

S..
  • 5,511
  • 2
  • 36
  • 43
anna
  • 1,001
  • 6
  • 23
  • 40

1 Answers1

0

In your fiddle, there is a trailing space in the video param:

<param name="movie" value="http://www.youtube.com/v/fBZTbCrM2eQ&amp;hl=en_US&amp;fs=1&wmode=opaque ">

which after your js manipulation becomes:

<param name="movie" value="http://www.youtube.com/v/fBZTbCrM2eQ&hl=en_US&fs=1&wmode=opaque &enablejsapi=1&version=3">

I'm not sure if that should be enough to break things for the browsers using the <object> rather than the <embed>, but it could be worth trying to remove.

I tried removing the space in your fiddle but for some strange reason that edit refused to take effect.

Peter Herdenborg
  • 5,736
  • 1
  • 20
  • 21