View Full Version : Slide show
jboogie
04-18-2006, 10:17 AM
How do I make it so my pics fade in and out like a slide show.. I currently have it set to scrolling across in Marqee, but would be much nicer if the pictures fade in and out.. Any help??
lwyau
04-18-2006, 12:26 PM
If you are comfortable in implementing DHTML codes, you can find a number of available slideshow scripts here:
http://dynamicdrive.com/dynamicindex14/index.html
If, on the other hand, you would rather have a professional do it, PM me and I'll be more than happy to do it for you for a small fee... :)
jboogie
04-18-2006, 02:14 PM
If you are comfortable in implementing DHTML codes, you can find a number of available slideshow scripts here:
http://dynamicdrive.com/dynamicindex14/index.html
If, on the other hand, you would rather have a professional do it, PM me and I'll be more than happy to do it for you for a small fee... :)
Thanks for the offer, I am a newb and run a site for my son's baseball team.. and FREE advice would be greatly appreciated..
:)
lwyau
04-18-2006, 04:58 PM
Alright, here is a script you can save as custom code say "slideshow.inc". Upload it and drag and drop on a page.
To customize it to your need, take a look at the first few lines of the code.
Notice that widths and heights of all images have to be the same. As coded, it is 450 pixels wide and tall. As coded, the images are named slide1.jpg through slide6.jpg. You can add and take away images. Just make sure you have indices in consecutive order starting with 0 through whatever. Upload all images and you are set to go.
<script language="JavaScript1.2" type="text/javascript">
/***********************************************
* Fade-in image slideshow script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
var slideshow_width='450px' //SET IMAGE WIDTH
var slideshow_height='450px' //SET IMAGE HEIGHT
var pause=3000 //SET PAUSE BETWEEN SLIDE (3000=3 seconds)
var fadeimages=new Array()
//SET IMAGE PATHS. Extend or contract array as needed
fadeimages[0]="images/slide1.jpg"
fadeimages[1]="images/slide2.jpg"
fadeimages[2]="images/slide3.jpg"
fadeimages[3]="images/slide4.jpg"
fadeimages[4]="images/slide5.jpg"
fadeimages[5]="images/slide6.jpg"
////NO need to edit beyond here/////////////
var preloadedimages=new Array()
for (p=0;p<fadeimages.length;p++){
preloadedimages[p]=new Image()
preloadedimages[p].src=fadeimages[p]
}
var ie4=document.all
var dom=document.getElementById
if (ie4||dom)
document.write('<div style="position:relative;width:'+slideshow_width+';height :'+slideshow_height+';overflow:hidden"><div id="canvas0" style="position:absolute;width:'+slideshow_width+';height :'+slideshow_height+';top:0;left:0;filter:alpha(op acity=10);-moz-opacity:10"></div><div id="canvas1" style="position:absolute;width:'+slideshow_width+';height :'+slideshow_height+';top:0;left:0;filter:alpha(op acity=10);-moz-opacity:10;visibility: hidden"></div></div>')
else
document.write('<img name="defaultslide" src="'+fadeimages[0]+'">')
var curpos=10
var degree=10
var curcanvas="canvas0"
var curimageindex=0
var nextimageindex=1
function fadepic(){
if (curpos<100){
curpos+=10
if (tempobj.filters)
tempobj.filters.alpha.opacity=curpos
else if (tempobj.style.MozOpacity)
tempobj.style.MozOpacity=curpos/101
}
else{
clearInterval(dropslide)
nextcanvas=(curcanvas=="canvas0")? "canvas0" : "canvas1"
tempobj=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
tempobj.innerHTML='<img src="'+fadeimages[nextimageindex]+'">'
nextimageindex=(nextimageindex<fadeimages.length-1)? nextimageindex+1 : 0
var tempobj2=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
tempobj2.style.visibility="hidden"
setTimeout("rotateimage()",pause)
}
}
function rotateimage(){
if (ie4||dom){
resetit(curcanvas)
var crossobj=tempobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
crossobj.style.zIndex++
tempobj.style.visibility="visible"
var temp='setInterval("fadepic()",50)'
dropslide=eval(temp)
curcanvas=(curcanvas=="canvas0")? "canvas1" : "canvas0"
}
else
document.images.defaultslide.src=fadeimages[curimageindex]
curimageindex=(curimageindex<fadeimages.length-1)? curimageindex+1 : 0
}
function resetit(what){
curpos=10
var crossobj=ie4? eval("document.all."+what) : document.getElementById(what)
if (crossobj.filters)
crossobj.filters.alpha.opacity=curpos
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=curpos/101
}
function startit(){
var crossobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
crossobj.innerHTML='<img src="'+fadeimages[curimageindex]+'">'
rotateimage()
}
if (ie4||dom)
window.onload=startit
else
setInterval("rotateimage()",pause)
</script>
jboogie
04-19-2006, 08:29 AM
Alright, here is a script you can save as custom code say "slideshow.inc". Upload it and drag and drop on a page.
To customize it to your need, take a look at the first few lines of the code.
Notice that widths and heights of all images have to be the same. As coded, it is 450 pixels wide and tall. As coded, the images are named slide1.jpg through slide6.jpg. You can add and take away images. Just make sure you have indices in consecutive order starting with 0 through whatever. Upload all images and you are set to go.
<script language="JavaScript1.2" type="text/javascript">
/***********************************************
* Fade-in image slideshow script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
var slideshow_width='450px' //SET IMAGE WIDTH
var slideshow_height='450px' //SET IMAGE HEIGHT
var pause=3000 //SET PAUSE BETWEEN SLIDE (3000=3 seconds)
var fadeimages=new Array()
//SET IMAGE PATHS. Extend or contract array as needed
fadeimages[0]="images/slide1.jpg"
fadeimages[1]="images/slide2.jpg"
fadeimages[2]="images/slide3.jpg"
fadeimages[3]="images/slide4.jpg"
fadeimages[4]="images/slide5.jpg"
fadeimages[5]="images/slide6.jpg"
////NO need to edit beyond here/////////////
var preloadedimages=new Array()
for (p=0;p<fadeimages.length;p++){
preloadedimages[p]=new Image()
preloadedimages[p].src=fadeimages[p]
}
var ie4=document.all
var dom=document.getElementById
if (ie4||dom)
document.write('<div style="position:relative;width:'+slideshow_width+';height :'+slideshow_height+';overflow:hidden"><div id="canvas0" style="position:absolute;width:'+slideshow_width+';height :'+slideshow_height+';top:0;left:0;filter:alpha(op acity=10);-moz-opacity:10"></div><div id="canvas1" style="position:absolute;width:'+slideshow_width+';height :'+slideshow_height+';top:0;left:0;filter:alpha(op acity=10);-moz-opacity:10;visibility: hidden"></div></div>')
else
document.write('<img name="defaultslide" src="'+fadeimages[0]+'">')
var curpos=10
var degree=10
var curcanvas="canvas0"
var curimageindex=0
var nextimageindex=1
function fadepic(){
if (curpos<100){
curpos+=10
if (tempobj.filters)
tempobj.filters.alpha.opacity=curpos
else if (tempobj.style.MozOpacity)
tempobj.style.MozOpacity=curpos/101
}
else{
clearInterval(dropslide)
nextcanvas=(curcanvas=="canvas0")? "canvas0" : "canvas1"
tempobj=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
tempobj.innerHTML='<img src="'+fadeimages[nextimageindex]+'">'
nextimageindex=(nextimageindex<fadeimages.length-1)? nextimageindex+1 : 0
var tempobj2=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
tempobj2.style.visibility="hidden"
setTimeout("rotateimage()",pause)
}
}
function rotateimage(){
if (ie4||dom){
resetit(curcanvas)
var crossobj=tempobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
crossobj.style.zIndex++
tempobj.style.visibility="visible"
var temp='setInterval("fadepic()",50)'
dropslide=eval(temp)
curcanvas=(curcanvas=="canvas0")? "canvas1" : "canvas0"
}
else
document.images.defaultslide.src=fadeimages[curimageindex]
curimageindex=(curimageindex<fadeimages.length-1)? curimageindex+1 : 0
}
function resetit(what){
curpos=10
var crossobj=ie4? eval("document.all."+what) : document.getElementById(what)
if (crossobj.filters)
crossobj.filters.alpha.opacity=curpos
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=curpos/101
}
function startit(){
var crossobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
crossobj.innerHTML='<img src="'+fadeimages[curimageindex]+'">'
rotateimage()
}
if (ie4||dom)
window.onload=startit
else
setInterval("rotateimage()",pause)
</script>
Thanks Alot man, works great!! Kids are going to love it!!
lwyau
04-19-2006, 09:51 AM
I'm glad it works for you. Would you mind sharing the website?
jboogie
05-03-2006, 10:35 AM
will this script only work once on a site? I get a red x when trying to put up another slideshow..
lwyau
05-03-2006, 12:46 PM
Without modifications, it only works once on a page. A script like this uses a lot of variable names which have to be unqiue.
You can use it on different pages.
jboogie
05-03-2006, 02:02 PM
Thanks for the response.. but that's the thing, I can't get it to work on another page..
lwyau
05-03-2006, 02:34 PM
I've used it on multiple pages without problems. Do check the spelling of the image files carefully. Start from scratch by copying the working script, modify only the first few lines, and save it as a different .inc file.
GingerCat
05-24-2006, 02:53 AM
what about just using flash? itseasier to implement.
Ruben
05-27-2006, 07:53 PM
If you guys and girls wait for a few days/weeks, when the new soholaunch will be introduced, we will launch a premium gallery module for soholaunch.
Check the presentation video here. http://sohotemplates.com/tutor/premiumgallery.htm
vBulletin® v3.7.2, Copyright ©2000-2008, Jelsoft Enterprises Ltd.