View Full Version : Background Image Slideshow inside a Table
Goodin
07-31-2005, 02:06 PM
I have a question about the Background image slideshow at:
http://www.dynamicdrive.com/dynamicindex14/bgslide.htm
I would like to have a background image slideshow for a table, rather than the page. Is this possible?
Thank you very much.
Charles C. Goodin
jscheuer1
07-31-2005, 08:33 PM
Yes!
<html>
<head>
<title></title>
<style>
#bslide {
/*Remove below line to make bgimage NOT fixed*/
background-attachment:fixed;
background-repeat: no-repeat;
/*Use center center in place of 300 200 to center bg image*/
background-position: center;
}
</style>
<script language="JavaScript1.2">
//Background Image Slideshow- © Dynamic Drive (www.dynamicdrive.com)
//For full source code, 100's more DHTML scripts, and TOS,
//visit http://www.dynamicdrive.com
//Specify background images to slide
var bgslides=new Array()
bgslides[0]="thumb2/photo1.jpg"
bgslides[1]="thumb2/photo2.jpg"
bgslides[2]="thumb2/photo3.jpg"
//Specify interval between slide (in miliseconds)
var speed=3000
//preload images
var processed=new Array()
for (i=0;i<bgslides.length;i++){
processed[i]=new Image()
processed[i].src=bgslides[i]
}
var inc=-1
function slideback(){
if (inc<bgslides.length-1)
inc++
else
inc=0
document.getElementById? document.getElementById('bslide').background=processed[inc].src : document.all['bslide'].background=processed[inc].src
}
if (document.all||document.getElementById)
window.onload=new Function('setInterval("slideback()",speed)')
</script>
</head>
<body>
<table id="bslide" height="225" width="140">
<tr>
<td> </td>
</tr>
</table>
</body>
</html>
Goodin
08-01-2005, 07:43 AM
Aloha,
Thank you very much.
That worked very well.
Charles C. Goodin
koushikgattu
07-05-2007, 04:06 PM
Hey,
http://www.dynamicdrive.com/forums/archive/index.php/t-4103.html
I tried its working in IE but not in Mozilla Firefox.
Can anyone help me with that?
Thank you,
Koushik Gattu.
jscheuer1
07-05-2007, 08:18 PM
Gee that's an old post and an even older script! Try this out:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
#bslide {
height:225px;
width:140px;
}
</style>
<script type="text/javascript">
//Background Image Slideshow- © Dynamic Drive (www.dynamicdrive.com)
//For full source code, 100's more DHTML scripts, and TOS,
//visit http://www.dynamicdrive.com
//Specify background images to slide
var bgslides=new Array()
bgslides[0]="photo1.jpg"
bgslides[1]="photo2.jpg"
bgslides[2]="photo3.jpg"
//Specify interval between slide (in miliseconds)
var speed=3000
//preload images
var processed=new Array()
for (i=0;i<bgslides.length;i++){
processed[i]=new Image()
processed[i].src=bgslides[i]
}
var inc=-1
function slideback(){
if (inc<bgslides.length-1)
inc++
else
inc=0
document.getElementById? document.getElementById('bslide').style.backgroundImage='url('+processed[inc].src+')' : document.all['bslide'].background=processed[inc].src
}
if (document.all||document.getElementById)
window.onload=new Function('slideback();setInterval("slideback()",speed)')
</script>
</head>
<body>
<table id="bslide">
<tr>
<td> </td>
</tr>
</table>
</body>
</html>
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.