| 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 webpageThe 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. <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 scriptfileNow 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 |


Hi
auch von mir ein großes Dankeschön für das Script. Ich möchte mein statisches Bannerbild durch eine Slideshow ersetzen. Das ist mir mit ihrem JavaScript auch super gelungen. Allerdings war das ursprüngliche Bannerbild immer im Hintergrund und wurde von einem Text leicht überlagert.
Die Slideshow "drängt" sich jedoch immer in den Vordergrund. Ich habe versucht, innerhalb des JavaScripts mit dem Z-Index zu spielen. Blieb aber erfolglos.
Haben Sie mir eine Idee?
Hier mal die Seite:
http://www.netzwerk43.de/IndexFlashbanner
Aussehen sollte es aber so:
http://www.netzwerk43.de
Vielen Dank im Voraus
Den Z-Index des Text DIVs half leider auch nicht.
Ich habe die Position des Text DIVs nun in "absolute" geändert und die Position angepaßt. Jetzt funktionierts auch auf allen gängigen Browsern. Danke für die schnelle Antwort.
Hallo Herr Reichmann!
In diesem Fall bringt es nichts, am zIndex der Slideshow zu schrauben, die Werte dort sind ja selbst mit 1 und 2 schon zu hoch und ins Negative lassen sie sich nicht setzen. Man muss also dafür sorgen, dass der Inhalt des Artikels VOR der Slideshow und nicht die Slideshow HINTER dem Inhalt angezeigt wird. Langer Rede kurzer Sinn: Den zIndex des Inhalts auf zumindest 3 hochsetzen (Stylesheet des Templates).
Gruß
Andreas Berger
Ja, Du kannst den Parameter "def_backgr" auf "transparent" setzen. Das ist aber mit Vorsicht zu geniessen, denn wenn Du Bilder verschiedener Proportion verwendest, dann wird das nächste Bild - wo es grösser als das aktuelle ist - schlagartig sichtbar und nicht eingefadet.
Gruß
Andreas
vielen Dank für die Antwort. Habe den Fehler gefunden.
Das 'body onload' hat die Slideshow gestört. In einem iframe läuft sie jetzt.
Bis auf einen Wechsel klappt es. Da zeigt er nur den Hintergrund an, der sollte
bei mir allerdings druchsichtig sein...
Gibt es dafür eine Einstellung?
Danke und VG
Nina
Ja, es kann sein, dass ein anderes Script die Slideshow blockiert.
... hat Dir die Antwort geholfen?
Das habe ich befürchtet. Also, wenn Du einen Link zur Seite postest, dann schau ich mir das gerne an. In den meisten Fällen lassen sich derlei Probleme recht einfach lösen.
Gruß
Andreas
erst einmal vielen Dank für das schöne Script.
Leider bekomme ich es auf meiner HP nicht zum Laufen.
Kann es sein, dass ein anderes Java Script die Slideshow blockiert?
Habe noch eine vertikale Navi mit Java auf der Seite...
In einer extra Datei ohne weiteren Inhalt läuft die Slideshow ohne Probleme.
Die Pfade und alles müßten richtig sein.
Vielen Dank für Deine Antwort.
Wenn Du Dir auf der Seite "Slideshow" (http://www.bretteleben.de/lang-de/javascript/slideshow.html) die Kommunikation mit Ingo Busch (Kommentare 119 und 120 vom 29.10.2009) ansiehst, dort ist erklärt wie das Script zu modifizieren ist.
Gruß
Andreas
erst mal muss ich sagen das das Skript und die Erklärung dazu wirklich super sind.
Allerdings habe ich eine Frage zu der Endlosschleife. Im Gegensatz zum Matthias möchte ich dass das Skript beim letzten Bild stehen bleibt. Ist das über irgendeine Einstellung möglich?
Vielen Dank
Charlotte
Wunsch erfüllt! Das Script endet nicht mit dem letzten Bild sondern läuft in einer Endlosschleife (nimm Dir mal zwei, drei Tage Zeit, das anhand dieser Seite zu überprüfen). Wenn bei Dir nach dem letzten Bild Ende ist, dann geht irgend etwas schief. Ein Link zur Seite und ich schau mir das gerne an.
Gruß
Andreas
tolles Script! Leider habe ich erst nach Einbau bemerkt, dass es nicht automatisch wiederholt.
Das würde ich mir wünschen.. :-)
Gruß Matthias
Unter dem Abschnitt "Joomla" im Menü links auf der Seite findest Du das "Simple Picture Slideshow" Plugin, das genau dafür entwickelt ist. Für die Darstellung von Slideshows in Joomla! Artikeln.
Gruß
Andreas