tags:

views:

166

answers:

2

Hey all, I'm looking for a fresh set of eyes to check out this code and see if you can tell me why it isn't working properly... I've actually used this same code before with 1.3.2 and it is fine, but for some reason with 1.4.1 I'm having troubles... am I missing something?

$(".item").click(function() {       
    var yt_vid = $(this).children('img').attr("id");

    $("#youtube").fadeOut(300, function() {
        $("#youtube").replaceWith('<object id="youtube" type="application/x-shockwave-flash" style="width:488px; height:300px; display:none;" data="http://www.youtube.com/v/' + yt_vid + '&hl=en_US&fs=1&hd=1"><param name="movie" value="http://www.youtube.com/v/' + yt_vid + '&hl=en_US&fs=1&hd=1" /><param wmode="transparent"><\/param><\/object>');

        $('#youtube').fadeIn(1000);
    });
});

The #youtube is added on document load with the following code:

    var initialVid = $(".item").children('img').attr("id");
$("#youtubePlayer").append('<object id="youtube" type="application/x-shockwave-flash" style="width:488px; height:300px;" data="http://www.youtube.com/v/' + initialVid + '&hl=en_US&fs=1&hd=1"><param name="movie" value="http://www.youtube.com/v/' + initialVid + '&hl=en_US&fs=1&hd=1" /><param wmode="transparent"><\/param><\/object>');

Anytime I click .item, i get error 'D is not defined' in firebug and down the list i see an error on line 36 (the #youtube.fadeOut line)

Thanks!

+1  A: 

The object tag is not allowing a fadeTo.

Keep your object inside of a div. And then fadeOut the div.

Try this instead of replaceWith

$("#youtube").html('<object type="appli... 

So you keep your div with id="youtube" and do not give the object an id.

The Who
is this something that was supported in past versions..?
Dave Kiss
A: 
  1. $("#youtube") exists?
  2. can you switch to jquery dev lib (uncompressed) and report error instead of "D is not defined"
Anatoliy
"queue is undefined" ... #youtube exists on an object tag, is this illegal?
Dave Kiss