Problème de slide (btn bas et haut) pour galerie
Répondre à la discussion
Affichage des résultats 1 à 2 sur 2

Problème de slide (btn bas et haut) pour galerie



  1. #1
    invite409f95b4

    Problème de slide (btn bas et haut) pour galerie


    ------

    Bonjour tout le monde,

    Je viens vers vous pour avoir quelques pistes coup de pouce...

    Voilà je souhaite réaliser une galerie, il y à 32 images à mettre donc je souhaite faire une galerie avec un slide verticale.
    J'ai deux boutons qui me servent pour monter ou descendre.

    J'ai réalisé le hmlt et css et maintenant je me perds un peu voir beaucoup sur le javascript... Ce que j'ai fais ne fonctionne pas (j'ai réussi à faire en sorte que le bouton bas fonctionne, mais je ne sais pas ce que j'ai touché, mais il ne fonctionne plus. Le problème lorsqu'il fonctionné c'était qu'il ne s'arrêter pas une fois la dernière image affichée...

    je vous joins mon code html css et javascript pour que vous puissiez me dire ce qui ne va pas dans mon code. Je vous remercie

    html:
    Code:
    <div id="galerie">
    
    <aside>
    <div class="haut"></div>
    <div class="bas"></div>
    </aside>
    <div class="slider">
    <a href="#"><img src="img/bg_image.png" width="167" height="153" alt="test"></a>
    <a href="#"><img src="img/bg_image.png" width="167" height="153" alt="test"></a>
    <a href="#"><img src="img/bg_image.png" width="167" height="153" alt="test"></a>
    <a href="#"><img src="img/bg_image.png" width="167" height="153" alt="test"></a>
    <a href="#"><img src="img/bg_image.png" width="167" height="153" alt="test"></a>
    <a href="#"><img src="img/bg_image.png" width="167" height="153" alt="test"></a>
    <a href="#"><img src="img/bg_image.png" width="167" height="153" alt="test"></a>
    <a href="#"><img src="img/bg_image.png" width="167" height="153" alt="test"></a>
    <a href="#"><img src="img/bg_image.png" width="167" height="153" alt="test"></a>
    <a href="#"><img src="img/bg_image.png" width="167" height="153" alt="test"></a>
    <a href="#"><img src="img/bg_image.png" width="167" height="153" alt="test"></a>
    <a href="#"><img src="img/bg_image.png" width="167" height="153" alt="test"></a>
    <a href="#"><img src="img/bg_image.png" width="167" height="153" alt="test"></a>
    <a href="#"><img src="img/bg_image.png" width="167" height="153" alt="test"></a>
    <a href="#"><img src="img/bg_image.png" width="167" height="153" alt="test"></a>
    <a href="#"><img src="img/bg_image.png" width="167" height="153" alt="test"></a>
    <a href="#"><img src="img/bg_image.png" width="167" height="153" alt="test"></a>
    <a href="#"><img src="img/bg_image.png" width="167" height="153" alt="test"></a>
    <a href="#"><img src="img/bg_image.png" width="167" height="153" alt="test"></a>
    <a href="#"><img src="img/bg_image.png" width="167" height="153" alt="test"></a>
    <a href="#"><img src="img/bg_image.png" width="167" height="153" alt="test"></a>
    <a href="#"><img src="img/bg_image.png" width="167" height="153" alt="test"></a>
    <a href="#"><img src="img/bg_image.png" width="167" height="153" alt="test"></a>
    <a href="#"><img src="img/bg_image.png" width="167" height="153" alt="test"></a>
    <a href="#"><img src="img/bg_image.png" width="167" height="153" alt="test"></a>
    <a href="#"><img src="img/bg_image.png" width="167" height="153" alt="test"></a>
    <a href="#"><img src="img/bg_image.png" width="167" height="153" alt="test"></a>
    <a href="#"><img src="img/bg_image.png" width="167" height="153" alt="test"></a>
    <a href="#"><img src="img/bg_image.png" width="167" height="153" alt="test"></a>
    <a href="#"><img src="img/bg_image.png" width="167" height="153" alt="test"></a>
    <a href="#"><img src="img/bg_image.png" width="167" height="153" alt="test"></a>
    <a href="#"><img src="img/bg_image.png" width="167" height="153" alt="test"></a>
    </div>
    
    
    </div>
    
    </section>
    le css concerné :
    Code:
    #galerie {
    	width:800px;
    	margin-top: 30px;
    	float:left;
    	height: 500px;
    	overflow:hidden;
    	margin-bottom:20px;
    	position:relative;
    }
    
    #galerie img {
    	margin: 5px 5px;
    }
    
    .haut {
    	background-image:url(img/prec.png);
    	width: 20px;
    	height:20px;
    	margin-bottom:10px;
    	margin-left: 25%px;
    	margin-right:20px;
    	position:absolute;
    }
    .haut:hover {
    	background-image:url(img/suivant.png);
    	width: 20px;
    	height:20px;
    	-moz-transform: rotate(180deg);
    	-webkit-transform: rotate(180deg);
    	-o-transform: rotate(180deg);
    	transform: rotate(180deg);
    }
    
    .bas {
    	background-image:url(img/prec.png);
    	width: 20px;
    	height:20px;
    	margin-left: 4.2%;
    	position:absolute;
    	margin-right:20px;
    	-moz-transform: rotate(180deg);
    	-webkit-transform: rotate(180deg);
    	-o-transform: rotate(180deg);
    	transform: rotate(180deg);
    }
    .bas:hover {
    	background-image:url(img/suivant.png);
    	width: 20px;
    	height:20px;
    	-moz-transform: rotate(0deg);
    	-webkit-transform: rotate(0deg);
    	-o-transform: rotate(0deg);
    	transform: rotate(0deg);
    }
    
    .slider {
    	height: 50000px;
    	clear:both;
    	float:left;
    	margin-top:20px;
    	position:absolute;
    }
    et pour finir le javascript :
    Code:
    $(document).ready(function(){
    	s = new slider("#galerie");
    });
    
    var slider = function(id) {
    	self=this;
    	this.div = $(id);
    	this.slider=this.div.find(".slider");
    	this.hauteurCache = this.div.height();
    	this.hauteur=0;
    	this.div.find( 'a').each(function(){
    		self.hauteur+=$(this).height();
    	});
    	
    	this.haut = this.div.find(".haut");
    	this.bas = this.div.find(".bas");
    	this.saut = this.hauteurCache/2;
    	this.nbEtapes = Math.ceil(this.haureur/this.saut - this.hauterCache/this.saut);
    	this.courant=0;
    	
    	this.bas.click(function(){
    		//if(self.courant==this.nbEtapes){
    		self.courant++;
    		self.slider.animate({
    			top: -self.courant*self.saut
    		},1000);
    	//}
    });
    this.haut.click(function(){
    		if(self.courant>0){
    		self.courant++;
    		self.slider.animate({
    			top: self.courant*self.saut
    		},1000);
    	}
    });
    }
    J'ai réussi à en arriver jusque là grâce à des information et différents tutoriels, mais je sèche maintenant...

    Pourriez-vous me donner un coup de main et me dire qu'est-ce qu'il ne va pas dans mon code JavaScript ?

    Merci !

    -----

  2. #2
    invite409f95b4

    Re : Problème de slide (btn bas et haut) pour galerie

    Bonsoir tout le monde,

    Une personne qui saurait m'expliquer comment faire pour dire dans le script que lorsqu'il arrive sur la dernière image il ne peut aller plus loin?

    Merci à vous !

Discussions similaires

  1. Aide pour un filtre passe bas et passe haut.
    Par invite8f0ce5da dans le forum Électronique
    Réponses: 12
    Dernier message: 11/09/2011, 13h37
  2. Niveau haut et bas
    Par pidofra dans le forum Électronique
    Réponses: 32
    Dernier message: 05/08/2011, 15h26
  3. Radiateur Chaud en haut et froid en bas...
    Par conscience dans le forum Dépannage
    Réponses: 7
    Dernier message: 04/02/2010, 17h16
  4. [Blanc] Probleme frigo side by slide samsung
    Par invite36abbc85 dans le forum Dépannage
    Réponses: 2
    Dernier message: 20/02/2009, 14h24
  5. Filtre Rc passe haut et bas^^
    Par jo-electrons dans le forum Électronique
    Réponses: 8
    Dernier message: 17/11/2007, 13h56