drawcode / jquery-oembed

Automatically exported from code.google.com/p/jquery-oembed
0 stars 0 forks source link

I´m trying to open a "Lightbox" popup with the oembed content #8

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. click() event on a link
2. Call Oembed and write in a div with html()
3. Open a popup with the content of the div

What is the expected output? What do you see instOead?
The expected is that the popup opens the content. It does, but sometimes
the content arrive when the popup is already open. The popup set its own
width, height and position based on the size of the content so it show in a
wrong position and wrong size. If you open the image again, the image
arrives faster so the popup opens with the correct size.

What version of the product are you using? On what operating system?
jquery.oembed 1.03
overlay jquery tools: http://flowplayer.org/tools/overlay.html

Please provide any additional information below.

I´m trying to find a solution to hold the popup until the code arrives, but
I can´t find it. I thought that html() was an Asynchronous operation, so
the code of the popup doesn´t execute until html() is finished, but not. :(

This is the actual code:

$(".commentsdis a").click(function (event) {                                    event.preventDefault();
      $('#comentarios
.contentWrap').oembed($(this).attr("href"),{embedMethod:
"fill"},function(container, oembed)
{                               container.html(oembed.code);
$("#comentarios").overlay({
          expose:{color: '#000',opacity:0.8},
          api: true,
          onBeforeLoad: function() {
/* If I put the width, height code here, the problem is worse, so I change
the size just after call to load the popup */
},
          onClose: function(){
          $('#comentarios .contentWrap').empty();
          }
}).load();
$('#comentarios').width($('#comentarios .contentWrap').width());
$('#comentarios').height($('#comentarios .contentWrap').height());
}); 
});

I would appreciate any help, thank you!

Original issue reported on code.google.com by lima...@gmail.com on 14 Jan 2010 at 11:09

GoogleCodeExporter commented 9 years ago
I resolved this by using oembed.width and oembed.height. With this the popup 
doesn´t
need waiting to the image to open with the correct size.

Original comment by lima...@gmail.com on 15 Jan 2010 at 12:35

GoogleCodeExporter commented 9 years ago

Original comment by rchamo...@gmail.com on 15 Mar 2010 at 10:30