Précédent   Forum des professionnels en informatique > Webmasters - Développement Web > JavaScript > Bibliothèques & Frameworks > jQuery
jQuery Forum d'entraide sur le framework jQuery. Avant de poster : Tutoriels jQuery, FAQ jQuery, Tous les tutoriels JavaScript, Toutes les FAQ JavaScript
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 09/02/2011, 17h55   #1
Invité régulier
 
Homme
Inscription : mars 2007
Messages : 20
Détails du profil
Informations personnelles :
Sexe : Homme

Informations forums :
Inscription : mars 2007
Messages : 20
Points : 6
Points : 6
Par défaut Slider Jquery et chargement d'images

bonjour,
je viens à vous face à un problème rencontrer, ou plutot une difficulté rencontrée avec un script que j'ai fais : un petit slider basé sur jquery.
il fait donc s'afficher des images, les une après les autres avec un timer. mais la premiè-re image s'affiche toujours après la première boucle du timer (ici 5 secondes)
pourriez vous m'indiquer une piste pour régler cette légère prise de tête?
voici les codes javascript:

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 
function slideShow (container, speed) {
 
	//Set the opacity of all images to 0
	$(container+' li').css({opacity: 0.0});
 
	//Get the first image and display it (set it to full opacity)
	//if no IMGs have the show class, grab the first image
	//ul.slideshow
	var current = ($(container+' li.show')?  $(container+' li.show') : $(container+' li:first'));
	$(current).css({opacity: 1.0});
	//Call the gallery function to run the slideshow	
	var timer = setInterval('gallery("'+container+'")',speed);
}
function gallery(container) {
	//if no IMGs have the show class, grab the first image
	var current = ($(container+' li.show')?  $(container+' li.show') : $(container+' li:first'));
 
	//Get next image, if it reached the end of the slideshow, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().attr('id') == 'slideshow-caption')? $(container+' li:first') :current.next()) : $(container+' li:first'));
 
	//Set the fade in effect for the next image, show class has higher z-index
	next.css({opacity: 0.0}).addClass('show').animate({opacity: 1.0}, 1000);
	//Hide the current image
	current.animate({opacity: 0.0}, 1000).removeClass('show'); 
 
}
et l'appel :
Code :
1
2
3
4
5
6
 
<script type="text/javascript">
$(document).ready(function() {
 slideShow('ul.monslide',5000);
});
</script>
merci par avance de vos réponses
kangun est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 10/02/2011, 23h34   #2
Rédacteur
 
Avatar de danielhagnoul
 
Homme Daniel Hagnoul
Étudiant perpétuel
Inscription : février 2009
Messages : 3 221
Détails du profil
Informations personnelles :
Nom : Homme Daniel Hagnoul
Âge : 61
Localisation : Belgique

Informations professionnelles :
Activité : Étudiant perpétuel
Secteur : Enseignement

Informations forums :
Inscription : février 2009
Messages : 3 221
Points : 6 767
Points : 6 767
Bonsoir

Citation:
Envoyé par kangun Voir le message
bonjour,
je viens à vous face à un problème rencontrer, ou plutot une difficulté rencontrée avec un script que j'ai fais : un petit slider basé sur jquery.
il fait donc s'afficher des images, les une après les autres avec un timer. mais la premiè-re image s'affiche toujours après la première boucle du timer (ici 5 secondes) [...]
Citation:
//Get next image, if it reached the end of the slideshow, rotate it back to the first image
__________________

FAQ jQuery

Mon cahier d’exercices sur jQuery & Co

Si un message vous a aidé ou vous semble pertinent, votez pour lui !
danielhagnoul est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 12/02/2011, 12h17   #3
Invité régulier
 
Homme
Inscription : mars 2007
Messages : 20
Détails du profil
Informations personnelles :
Sexe : Homme

Informations forums :
Inscription : mars 2007
Messages : 20
Points : 6
Points : 6
alors on dira adapté et par là grandement réécrit
pas envie de recréer la roue, mais refaire la charrette qui va dessus
kangun est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 06h29.


 
 
 
 
Partenaires

Hébergement Web