473,748 Members | 7,827 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Image Slide Show

54 New Member
Greetings everyone,

I´ve developed a script to make a slideshow using a holder and the images you need. Just place the images you need within a holder, pass the holder ID to the script and its done!

the parameters are:
holder - id of the holder
speed - change this number to increase/increase speed (lower = faster)
width - width of the holder / images within
height - height of the holder / images within

Expand|Select|Wrap|Line Numbers
  1. //////////////////////////////////////
  2. // Romulo do Nascimento Ferreira     //
  3. //         romulo.nf@gmail.com            //
  4. //////////////////////////////////////
  5.  
  6. function makeSlideShow(holder,speed,width,height) {
  7. gallery = document.getElementById(holder)
  8. gallery.style.width = width + "px"
  9. gallery.style.height = height + "px"
  10. gallery.style.cssFloat = "left"
  11. this.alphaShow = 0
  12. this.alphaFade = 100
  13. this.currentImg = 0
  14. this.animationSpeed = speed
  15. this.images = gallery.getElementsByTagName("img")
  16. this.galleryLength = this.images.length
  17.  
  18.     for (x=0; x<this.galleryLength; x++) {
  19.     this.images[x].style.width = width + "px"
  20.     this.images[x].style.height = height + "px"
  21.     this.images[x].style.position = "absolute"
  22.  
  23.     this.images[x].style.filter = "alpha(opacity=0)"
  24.     this.images[x].style.opacity = "0"
  25.     this.images[x].style.mozOpacity = "0"
  26.     }
  27.  
  28. var _this = this
  29. var startShow = window.setInterval(function(){_this.engine()},this.animationSpeed*10)
  30. }
  31.  
  32. makeSlideShow.prototype.engine = function() {
  33. this.nextImage = this.currentImg + 1 < this.galleryLength ? this.currentImg + 1 : 0
  34.  
  35. this.images[this.currentImg].style.filter = "alpha(opacity=" + this.alphaFade + ")";
  36. this.images[this.currentImg].style.opacity = this.alphaFade < 10? "0.0" + this.alphaFade : this.alphaFade >= 10 && this.alphaFade < 100 ? "0." + this.alphaFade : 1.0;
  37. this.images[this.currentImg].style.mozOpacity = this.alphaFade < 10? "0.0" + this.alphaFade : this.alphaFade >= 10 && this.alphaFade < 100 ? "0." + this.alphaFade : 1.0;
  38.  
  39. this.images[this.nextImage].style.filter = "alpha(opacity=" + this.alphaShow + ")";
  40. this.images[this.nextImage].style.opacity = this.alphaShow < 10? "0.0" + this.alphaShow : this.alphaShow >= 10 && this.alphaShow < 100 ? "0." + this.alphaShow : 1.0;
  41. this.images[this.nextImage].style.mozOpacity = this.alphaShow < 10? "0.0" + this.alphaShow : this.alphaShow >= 10 && this.alphaShow < 100 ? "0." + this.alphaShow : 1.0;
  42.  
  43. this.alphaFade = this.alphaFade - 2
  44. this.alphaShow = this.alphaShow + 2
  45.  
  46.     if (this.alphaFade == 100 || this.alphaShow == 100) {
  47.     this.alphaFade = 100
  48.     this.alphaShow = 0
  49.     this.currentImg = this.currentImg + 1 > this.galleryLength-1 ? 0 : this.currentImg + 1
  50.     }
  51. }
  52.  
To make the script work you will need a holder with images like:
Expand|Select|Wrap|Line Numbers
  1. <div id="galeria1">
  2. <img src="t1.jpg">
  3. <img src="t2.jpg">
  4. <img src="t3.jpg">
  5. </div>
  6.  
And make the call:
Expand|Select|Wrap|Line Numbers
  1. new makeSlideShow('galeria1',4,150,100)
  2.  
Feel free to modify anything, just let my name there :P
Any questions use the email on the code!

Good luck
Jul 4 '07 #1
1 9799
jpshahom
1 New Member
Romulo,
I meant to say that it was a smart way of anchoring images in a slideshow.
thanks.
Jean-Pierre
Aug 27 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
17112
by: Tim | last post by:
Hope someone in the big wide world can help... What I want to do is have an image slideshow which automatically scrolls through a series of images very fast, then pauses when you move your mouse over the image. The images will flick through (at a rate of about 5 per second) then pause when the user onMouseOver's. Any help would be gratefully received. :o)
2
2390
by: Mekon | last post by:
I have never written a line of script in my life but I need some help with it now. I have this auto generated code which I want to modify if possible The script generates a strip of thumbnails, and works quite well execpt that on dial up it is unbearably slow. The Thumbnails themselves are only 10kb but the total of them is a lot larger. and it appears to need to load them all before it will display any.
0
1614
by: aarondouglas28 | last post by:
Hey all, I'm hoping someone can help me with a problem I'm having. I have a page that has a javascript based slide show of images on it. The user can press a play button and the page will cycle through all of the images that match a certain criteria. At any point, the user can press the stop button to stop the slide show. What I need is a button on the page, that when clicked, will prompt the user to download the image that is currently...
0
1391
by: | last post by:
We have developed a free image-viewer for testing .Net and GDI+ capabilityes. e-View supports a lot of raster and vectorial image formats: -Bitmap (BMP) -Graphics Interchange Format (GIF) -Joint Photographic Experts Group (JPG) -Portable Network Graphics (PNG) -Tag Image File Format (TIFF)
1
16509
by: www.web20developers.com | last post by:
http://www.web20developers.com http://www.web20developers.com/index.php?option=com_content&task=view... Ajallerix : AJAX, simple, fast Web image gallery demo ; at Novell AJAX - microlink pattern tutorial : A microlink is a link that opens up
1
1972
by: bn4 | last post by:
I have been trying to modify a script that i had working in the past but have lost.. ORIGINAL URL: http://www.thescripts.com/forum/thread147097.html STEPS: I want it to do the following: 1-Load a Random Image each time page loads or is refreshed / script starts (with corresponding url link when clicked) 2-Images change by blend/fade into one another, on an adjustable time delay 3-Next image loaded also loads new corresponding url/link
3
4975
by: Nebulism | last post by:
Hi everyone, I am working on a module for my GUI that shows one image with an index value below and would use a scrollbar to control which of the images are displayed. The images are stored in a successive folder in the format Pic#, i,e. Pic1, Pic2 etc. What I want to do is make a slider that is attached to a label which would output the slide number that is being looked at. I would use that number then to return the image of the slide...
22
3424
idsanjeev
by: idsanjeev | last post by:
Hi i have some image in slide show on load events. i wants to expand image on mouseover from slide show. thanks
2
2145
by: vineetbindal | last post by:
Hi all, We have a slide show in a page which shows slids rotating after every 8-10 seconds with some descriptions about them. The problem is if the connection speed is slow then the page loads fine but that slide show takes a lot of time to load and (the place we are running the slide show is white blank page till than) I dont understand why. can someone tell me what can we do for this. i have think of something like
0
8987
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8826
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9534
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9366
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6793
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4867
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2777
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2211
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.