Home Javascript Slideshow - Slideshow Sample 01
2010-09-09
Main Menu
external Links
Most Read
Support

If you like the products on these pages, your support is highly appreciated. Thank you very much!

Amount: 

JavaScript: Slideshow Sample01
Written by Andreas Berger   
Sunday, 01 March 2009 12:28

The first sample shows the standard configuration of the script. The starting basis: 1 page with 1 slideshow.

The file names "be_slide.html" and "be_slide.js" correspond with the file names in the sample that comes with the download of the script at JavaScript: slideshow. The following explanatory notes also refer to these files and show how to integrate the script from the HTML-page and set the parameters in the downloaded JavaScript be_slide.js.


be_slide.html - the webpage

The first step is to integrate the script into the webpage. To achieve this, it is linked from the HEAD-section of the page:
<script type="text/javascript" src="be_slide.js"></script>

The sample assumes, that the script is located in the same directory as the webpage, otherwise the path has to be adjusted.

The second step is to create a DIV-container in the BODY-section of your page, located where you want the slideshow to be displayed. Of importance is the IDENTITY of this DIV-container - in this sample it´s "slideshow" (id="slideshow"). It can be chosen, within the script we will set it as value of a parameter. The DIV-container can be positioned and styled as you want. This sample inserts on of the pictures - uploaded to a subfolder called "pics" - statically into the DIV-container to provide a fallback for visitors without JavaScript.
For visitors with JavaScript enabled this is of no importance, because the script replaces the content of the DIV-container with the slideshow.

<div id="slideshow" style="margin:25px;">
  <img src="pics/pic01a.jpg" style="width:400px;height:300px;" />
</div>

That´s it for the webpage.


be_slide.js - the scriptfile

Now we set the parameters in the scriptfile be_slide.js to fit our needs. The sample above uses the following values:

 

//*****parameters to set*****
 
var def_imges=new Array ('pics/pic01a.jpg', 'pics/pic01b.jpg', 'pics/pic01c.jpg');
    //In this array, set the pictures you want the slideshow to display.
 
var def_divid="slideshow";
    //The IDENTITY of the DIV-Containers,
    //we created to hold the slideshow
 
var def_picwid=400;
    //The width of the widest picture in pixel.
    //Notice: The script does not scale your pictures!
 
var def_pichei=300;
    //The height of the highest picture in pixel.
    //Notice: The script does not scale your pictures!
 
var def_backgr="#eeeeee";
    //The background-color of the slideshow. It is of importance
    //if you have pictures in your set, that do not fit the values
    //set above for width and height.
 
var def_sdur=3;
    //The time, a picture is shown between two transitions in seconds.
 
var def_fdur=1;
    //The time the transition should take
 
var def_steps=20;
    //The number of steps to blend from 0-100.
    //A value between 1-100, the higher the value
    // the smoother the transition.
 
var def_startwhen="y";
    //Should the slideshow start automatically?
    //"y" for Yes, "n" for No
 
var def_shuffle="y";
    //Should we start with a random picture?
    //"y" for Yes, "n" for No
 
var def_showcontr="y";
    //Should we show control-elements?
    //"y" for Yes, "n" for No
 
var def_contr=new Array('bwd.png','start.png','stop.png','fwd.png');
    //if you show control elements, you may choose between textlinks
    //and buttons. Into this array therefor insert either the text
    //you want to be displayed or the path to the image you want to
    //be used. If the script finds either .jpg or .gif or .png as the
    //ending of your input, it will display the image automatically.
    //The sort order of the elements displayed and therefor within this
    //array is: BACK - START - STOP - FWD
 
//****************************************************************
 

 


That´s it, have fun with the script!
Last Updated on Thursday, 26 November 2009 18:49
 
Comments (80)
@Silvia
10 Saturday, 09 May 2009 08:08
A. Berger
Hallo Silvia!

Im korrespondierenden Joomla-Plugin habe ich das bereits eingebaut. Es auf das Original rückzuportieren steht noch an.

Gruß
Andreas
Slideshow+Bilder "verlinken"
9 Thursday, 07 May 2009 10:32
Silvia
Hallo Andreas, ich habe gerade dieses Script entdeckt und finde es superklasse. Vor allem auch für Unerfahrene (so wie mich) einigermaßen zu "durchschauen".
Frage: Gibt es auch die Möglichkeit, die einzelnen Bilder innerhalb der Slideshow anzuklicken und somit einen (für jedes Bild unterschiedlichen) externen oder internen Link zu öffnen?

Grüße,
Silvia
@Per
8 Sunday, 03 May 2009 13:14
A. Berger
Hi Per!

Either provide a link or (if testing offline) zip the page (with all additional files) and send it per mail. I will have a look at it.

Kind regards
Andreas
Example 1
7 Sunday, 03 May 2009 12:10
Per
Hi Andreas! Thanks for a great script. I have followed your detailed describtion, but unfortenately it does not work. I can only see the file defined in the html file. Any suggestions?

Per
slideshow
6 Friday, 01 May 2009 22:09
michael
wow, vielen dank. die slideshow war wirklich einfach in die webseite einzubauen. alles gut kommentiert. ich waere auch darin interessiert, einen text mit dem jeweiligen bild anzuzeigen - mit dem selben file namen, nur mit der endung .txt. ist wahrscheinlich nicht zu schwierig, nur zeitaufwendig zu programmieren. ich werde auf jeden fall oefters mal deine webseite wieder anschauen.
gruss, michael.
@Finn
5 Tuesday, 21 April 2009 20:01
A. Berger
Hi Finn!

One general tip: Use Firefox to debug pages, it comes with an excellent Error Console.

About your current problem: You may want to either provide a link to a test-page or zip it and send it per mail. I will have a look at it.

Kind regards
Andreas
hmmm...
4 Tuesday, 21 April 2009 17:12
Finn
it's not working for me - any thoughts? General troubleshooting? I can't seem to get the javascript to display on the html site. I only get my first image. Ant help?
good job
3 Monday, 16 March 2009 12:56
trco
good job, easy to understanding, bravoo
@nurbeate
2 Sunday, 15 March 2009 17:11
A. Berger
Hallo nurbeate!

Ich berechne nichts für das Script.
Es ist unter der GNU GPL, der GNU General Public License lizensiert und das bedeutet, dass an die Verwendung und die Weitergabe bestimmte Bedingungen geknüpft sind.
Welche, das kann in der Lizenz unter (www.gnu.org/copyleft/gpl.html) nachgelesen werden. Es finden sich dort auch (unauthorisierte) Übersetzungen.

Gruß
Andreas
Slideshow
1 Sunday, 15 March 2009 16:25
nurbeate
sind die Script´s auch kostenlos, wenn man sie für eine Gewerblich HP einsetzt?