]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
Fixed image loading order [#485]
authorMohammed Buttu <mohammedbuttu@gmail.com>
Wed, 11 May 2011 17:16:51 +0000 (13:16 -0400)
committerMohammed Buttu <mohammedbuttu@gmail.com>
Wed, 11 May 2011 17:16:51 +0000 (13:16 -0400)
plugins/image/popcorn.image.js

index d83b658cb76bcc810e3d07a37f8f01072cac655b..b8b083725c8739810a13969f1690df4eaac61062 100644 (file)
         options.link.style.position = "relative";
         options.link.style.textDecoration = "none";
 
+        if ( document.getElementById( options.target ) ) {
+          document.getElementById( options.target ).appendChild( options.link ); // add the widget's div to the target div
+        }
+
         var img = document.createElement( 'img' );
         img.addEventListener( "load", function() {
           img.style.borderStyle = "none"; // borders look really bad, if someone wants it they can put it on their div target
@@ -61,9 +65,6 @@
             options.link.href = options.href;
           }
           options.link.target = "_blank";
-          if ( document.getElementById( options.target ) ) {
-            document.getElementById( options.target ).appendChild( options.link ); // add the widget's div to the target div
-          }
           
           var fontHeight = ( img.height / 12 ) + "px";