From: Minoo Date: Mon, 4 Apr 2011 21:32:58 +0000 (-0400) Subject: added position and height to a and img elements -#368 X-Git-Tag: v0.5~15^2~6 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=2fbe8d73265dd255bd322248fd6d02c519789f5f;p=popcorn-js.git added position and height to a and img elements -#368 --- diff --git a/plugins/image/popcorn.image.js b/plugins/image/popcorn.image.js index 328a8b5..dd97911 100644 --- a/plugins/image/popcorn.image.js +++ b/plugins/image/popcorn.image.js @@ -50,6 +50,10 @@ options.link = document.createElement( 'a' ); options.link.style.display = "none"; // display none by default + options.link.style.position = "relative"; + options.link.style.height = "100%"; + //options.link.style.width = "100%"; + if ( options.href ) { options.link.href = options.href; } @@ -58,23 +62,26 @@ document.getElementById( options.target ).appendChild( options.link ); // add the widget's div to the target div } - - - var img = document.createElement( 'img' ); img.src = options.src; + img.style.position = "absolute"; + img.style.height = "100%"; + //img.style.width = "100%"; img.style.borderStyle = "none"; // borders look really bad, if someone wants it they can put it on their div target + var fontHeight = ((document.getElementById( options.target ).offsetHeight) / 12) + "px"; + var divText = document.createElement( 'div' ); divTextStyle = { - position: 'absolute', - paddingTop: '20px', - paddingLeft: '20px', - paddingBottom: '0', - fontSize: 'large', - color: 'black', - fontWeight : 'bold', - zIndex: '10', + position: "absolute", + top: "50%", + textAlign: "center", + left: 0, + right: 0, + fontSize: fontHeight, + color: "black", + fontWeight : "bold", + zIndex: "10", }; for ( st in divTextStyle ) { divText.style[ st ] = divTextStyle[ st ]; @@ -92,7 +99,7 @@ * options variable */ start: function( event, options ) { - options.link.style.display = "inline"; + options.link.style.display = "block"; }, /** * @member image diff --git a/plugins/image/popcorn.image.unit.js b/plugins/image/popcorn.image.unit.js index 4e395ec..d6dd8cf 100644 --- a/plugins/image/popcorn.image.unit.js +++ b/plugins/image/popcorn.image.unit.js @@ -36,7 +36,7 @@ test("Popcorn Image Plugin", function () { if( popped.currentTime() > 1 && popped.currentTime() < 3 ) { ok( /display: inline;/.test( imagediv.innerHTML ), "Div contents are displayed" ); plus(); - equals (imagediv.children[0].children[0].style.backgroundImage.indexOf ( 'url' ), "0", "An image exists" ); + ok( /img/.test( imagediv.innerHTML ), "An image exists" ); plus(); clearInterval( interval ); }