target: 'imagediv'
} )
.image({
- start: 20, // seconds
+ start: 5, // seconds
end: 45, // seconds
// no href
src: 'http://patriciabergeron.net/wp-content/uploads/web.made_.movie_marquee.gif',
- text: 'WEB MADE MOVIES',
target: 'imagediv'
} );
</head>
<body>
<h1 id="qunit-header">Popcorn Image Plug-in Demo</h1>
- <p> An image will appear at 5 seconds and disappear at 15 seconds.</p>
- <p> An image will appear at 20 seconds and disappear at 45 seconds.</p>
+ <p> Two images will appear at 5 seconds.</p>
+ <p> First one (with an overlayed text) will disappear at 15 seconds.</p>
+ <p> Second one (without an overlayed text) will disappear at 45 seconds.</p>
<div>
<video id='video'
controls
_setup: function( options ) {
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%";
+ options.link.style.textDecoration = "none";
+ var img = document.createElement( 'img' );
+ img.src = options.src;
+ img.style.borderStyle = "none"; // borders look really bad, if someone wants it they can put it on their div target
+
if ( options.href ) {
options.link.href = options.href;
}
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 fontHeight = ( img.height / 12 ) + "px";
var divText = document.createElement( 'div' );
divTextStyle = {
- position: "absolute",
- top: "50%",
+ position: "relative",
+ width: img.width + "px",
textAlign: "center",
- left: 0,
- right: 0,
fontSize: fontHeight,
color: "black",
fontWeight : "bold",
for ( st in divTextStyle ) {
divText.style[ st ] = divTextStyle[ st ];
}
- divText.innerHTML = options.text;
+ divText.innerHTML = options.text || "";
options.link.appendChild( divText );
options.link.appendChild( img );
+ divText.style.top = ( img.height / 2 ) - ( divText.offsetHeight / 2 ) + "px";
+ options.link.style.display = "none";
},
/**
interval = setInterval( function() {
if( popped.currentTime() > 1 && popped.currentTime() < 3 ) {
- ok( /display: inline;/.test( imagediv.innerHTML ), "Div contents are displayed" );
+ ok( /display: block;/.test( imagediv.innerHTML ), "Div contents are displayed" );
plus();
ok( /img/.test( imagediv.innerHTML ), "An image exists" );
plus();