Bonjour,

Nom : Capture.JPG
Affichages : 175
Taille : 34,4 Ko

Sur cette image, j'essaye de vous montrer ce qui ne va pas dans l'affichage de la lightbox au survol sur l'image, celle-ci se déplace sur l'image suivante.
Je ne sais pas comment gérer l'affichage pour que la lightbox se mette sur l'image du dessous et pas sur la ligne.

Voici mon code :
Code php : Sélectionner tout - Visualiser dans une fenêtre à part
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
 
<?php
session_start();
if(!empty($_POST))
{
	extract($_POST);
	$validation=true;
 
	if(isset($_FILES['image']) AND $_FILES['image']['error']==0)
	{
		$infos_image=pathinfo($_FILES['image']['name']);
		$extension_image=$infos_image['extension'];
		$ext_autorisees=array('jpg','jpeg','png');
		if($_FILES['image']['size']>2000000)
		{
			$validation=false;
			$erreur_image='L\'image doit être inférieure à 2Mo';
		}
		elseif(!in_array($extension_image,$ext_autorisees))
		{
			$validation=false;
			$erreur_image='L\'image doit être au format jpg, jpeg ou png';
		}
	}
	else
	{
		$validation=false;
		$erreur_image='Indiquez l\'image que vous souhaitez publier';
	}
 
	if(empty($nom))
	{
		$validation=false;
		$erreur_nom='Donnez un nom à votre image';
	}
 
	if(empty($auteur))
	{
		$validation=false;
		$erreur_auteur='Indiquez l\'auteur de cette image';
	}
 
	if($validation)
	{
		$image=$_FILES['image']['name'];
		$tmp_name=$_FILES['image']['tmp_name'];
		include('bdd.php');
		$req=$bdd->prepare('INSERT INTO galerie (nom,auteur,image) VALUES (:nom,:auteur,:image)');
		$req->execute(array(
			'nom'=>$nom,
			'auteur'=>$auteur,
			'image'=>$image
		));
		$req->closeCursor();
		move_uploaded_file($tmp_name,"images/$image");
		$valide='L\'envoi de l\'image a bien été effectué !';
		unset($nom);
		unset($auteur);
	}
}
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="style.css"/>
<link rel="stylesheet" href="css/lightbox.css"/>
<script src="js/jquery-1.7.2.min.js"></script>
<script src="js/lightbox.js"></script>
<title>Galerie photos</title>
</head>
<body>
	<div class="page">
    	Ma galerie
        <div class="ligne"></div>
        <?php
		include('bdd.php');
		$nombre=$bdd->query("SELECT * FROM galerie ORDER BY id DESC");
		$total=$nombre->rowCount();
		$nb_page=$total/6;
		if(!isset($_GET['page'])){$page_actuelle=1;}else{$page_actuelle=$_GET['page'];}
		$liste=6*$page_actuelle-6;
		$req=$bdd->query("SELECT * FROM galerie ORDER BY id DESC LIMIT $liste,6");
		//pour la marge entre les images, condition pour mettre un margin-right ou pas
		$compteur=0;
		while($donnees_select=$req->fetch())
		{
			//incrémenter de 1 compteur à chaque passage
			$compteur=$compteur+1;
			?>
            <a href="images/<?php echo $donnees_select['image']; ?>" rel="lightbox" class="effet" title="<?php echo $donnees_select['nom']; ?> - Par <?php  echo $donnees_select['auteur']; ?>"><div class="cadre"><?php echo $donnees_select['nom']; ?> - Par <?php  echo $donnees_select['auteur']; ?></div></a><img src="images/<?php echo $donnees_select['image']; ?>" <?php if($compteur!=3){?>style="margin-right:6px;"<?php }else{$compteur=0;} ?>/>
            <?php
		}
		?>
        <div class="pagination">
        	-
            <?php
			$compteur_page=0;
			while($compteur_page<$nb_page)
			{
				$compteur_page=$compteur_page+1;
				?>
                <a href="index.php?page=<?php echo $compteur_page; ?>" <?php if($page_actuelle==$compteur_page){ ?>style="color:#e30059;text-decoration:underline;"<?php } ?>>Page <?php echo $compteur_page; ?></a> -
                <?php
			}
			?>
        </div>
        <?php
		if(!isset($_SESSION['administrateur']))
		{
			?>
            Administrer ma galerie
            <div class="ligne"></div>
            <form method="post" action="connexion.php">
                Mot de passe*<br><input type="password" name="pass" value=""/><?php if(isset($_GET['erreur'])){ ?><div class="erreur">Mot de passe erroné !</div><?php } ?>
                <br>
                <input type="submit" value="CONNEXION"/>
            </form>
            <?php
		}
		else
		{
			?>
            <a href="deconnexion.php" style="color:#e30059;text-decoration:underline;">Déconnexion de l'espace administrateur</a><br><br>
            Publier une nouvelle image dans la galerie
            <div class="ligne"></div>
            <form method="post" action="index.php" enctype="multipart/form-data">
            	<?php if(isset($valide)){ ?><div class="valide"><?php echo $valide; ?></div><?php } ?>
                Nom de la création*<br>
                <input type="text" name="nom" value="<?php if(isset($nom))echo $nom; ?>"/><?php if(isset($erreur_nom)){ ?><div class="erreur"><?php echo $erreur_nom; ?></div><?php } ?>
                <br>
                Auteur de la création*<br>
                <input type="text" name="auteur" value="<?php if(isset($auteur))echo $auteur; ?>"/><?php if(isset($erreur_auteur)){ ?><div class="erreur"><?php echo $erreur_auteur; ?></div><?php } ?>
                <br>
                Votre création*<br>
                <input type="file" name="image"/><?php if(isset($erreur_image)){ ?><div class="erreur_image"><?php echo $erreur_image; ?></div><?php } ?>
                <br>
                <input type="submit" value="ENVOYER"/>
            </form>
            <br>
            Modifier ou supprimer une image de la galerie
            <div class="ligne"></div>
            <ul>
            	<?php
				while($donnees_select=$nombre->fetch())
				{
					echo '<li><a href="gerer.php?id='.$donnees_select['id'].'">'.$donnees_select['nom'].' - Par '.$donnees_select['auteur'].'</a></li>';
				}
				?>
            </ul>
            <?php
		}
		?>
    </div>
</body>
</html>

lightbox.js

Code js : Sélectionner tout - Visualiser dans une fenêtre à part
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
 
 
/*
Lightbox v2.51
by Lokesh Dhakar - http://www.lokeshdhakar.com
 
For more information, visit:
http://lokeshdhakar.com/projects/lightbox2/
 
Licensed under the Creative Commons Attribution 2.5 License - http://creativecommons.org/licenses/by/2.5/
- free for use in both personal and commercial projects
- attribution requires leaving author name, author link, and the license info intact
 
Thanks
- Scott Upton(uptonic.com), Peter-Paul Koch(quirksmode.com), and Thomas Fuchs(mir.aculo.us) for ideas, libs, and snippets.
- Artemy Tregubenko (arty.name) for cleanup and help in updating to latest proto-aculous in v2.05.
 
 
Table of Contents
=================
LightboxOptions
 
Lightbox
- constructor
- init
- enable
- build
- start
- changeImage
- sizeContainer
- showImage
- updateNav
- updateDetails
- preloadNeigbhoringImages
- enableKeyboardNav
- disableKeyboardNav
- keyboardAction
- end
 
options = new LightboxOptions
lightbox = new Lightbox options
*/
 
(function() {
  var $, Lightbox, LightboxOptions;
 
  $ = jQuery;
 
  LightboxOptions = (function() {
 
    function LightboxOptions() {
      this.fileLoadingImage = 'images/loading.gif';
      this.fileCloseImage = 'images/close.png';
      this.resizeDuration = 700;
      this.fadeDuration = 500;
      this.labelImage = "Image";
      this.labelOf = "of";
    }
 
    return LightboxOptions;
 
  })();
 
  Lightbox = (function() {
 
    function Lightbox(options) {
      this.options = options;
      this.album = [];
      this.currentImageIndex = void 0;
      this.init();
    }
 
    Lightbox.prototype.init = function() {
      this.enable();
      return this.build();
    };
 
    Lightbox.prototype.enable = function() {
      var _this = this;
      return $('body').on('click', 'a[rel^=lightbox], area[rel^=lightbox]', function(e) {
        _this.start($(e.currentTarget));
        return false;
      });
    };
 
    Lightbox.prototype.build = function() {
      var $lightbox,
        _this = this;
      $("<div>", {
        id: 'lightboxOverlay'
      }).after($('<div/>', {
        id: 'lightbox'
      }).append($('<div/>', {
        "class": 'lb-outerContainer'
      }).append($('<div/>', {
        "class": 'lb-container'
      }).append($('<img/>', {
        "class": 'lb-image'
      }), $('<div/>', {
        "class": 'lb-nav'
      }).append($('<a/>', {
        "class": 'lb-prev'
      }), $('<a/>', {
        "class": 'lb-next'
      })), $('<div/>', {
        "class": 'lb-loader'
      }).append($('<a/>', {
        "class": 'lb-cancel'
      }).append($('<img/>', {
        src: this.options.fileLoadingImage
      }))))), $('<div/>', {
        "class": 'lb-dataContainer'
      }).append($('<div/>', {
        "class": 'lb-data'
      }).append($('<div/>', {
        "class": 'lb-details'
      }).append($('<span/>', {
        "class": 'lb-caption'
      }), $('<span/>', {
        "class": 'lb-number'
      })), $('<div/>', {
        "class": 'lb-closeContainer'
      }).append($('<a/>', {
        "class": 'lb-close'
      }).append($('<img/>', {
        src: this.options.fileCloseImage
      }))))))).appendTo($('body'));
      $('#lightboxOverlay').hide().on('click', function(e) {
        _this.end();
        return false;
      });
      $lightbox = $('#lightbox');
      $lightbox.hide().on('click', function(e) {
        if ($(e.target).attr('id') === 'lightbox') _this.end();
        return false;
      });
      $lightbox.find('.lb-outerContainer').on('click', function(e) {
        if ($(e.target).attr('id') === 'lightbox') _this.end();
        return false;
      });
      $lightbox.find('.lb-prev').on('click', function(e) {
        _this.changeImage(_this.currentImageIndex - 1);
        return false;
      });
      $lightbox.find('.lb-next').on('click', function(e) {
        _this.changeImage(_this.currentImageIndex + 1);
        return false;
      });
      $lightbox.find('.lb-loader, .lb-close').on('click', function(e) {
        _this.end();
        return false;
      });
    };
 
    Lightbox.prototype.start = function($link) {
      var $lightbox, $window, a, i, imageNumber, left, top, _len, _ref;
      $(window).on("resize", this.sizeOverlay);
      $('select, object, embed').css({
        visibility: "hidden"
      });
      $('#lightboxOverlay').width($(document).width()).height($(document).height()).fadeIn(this.options.fadeDuration);
      this.album = [];
      imageNumber = 0;
      if ($link.attr('rel') === 'lightbox') {
        this.album.push({
          link: $link.attr('href'),
          title: $link.attr('title')
        });
      } else {
        _ref = $($link.prop("tagName") + '[rel="' + $link.attr('rel') + '"]');
        for (i = 0, _len = _ref.length; i < _len; i++) {
          a = _ref[i];
          this.album.push({
            link: $(a).attr('href'),
            title: $(a).attr('title')
          });
          if ($(a).attr('href') === $link.attr('href')) imageNumber = i;
        }
      }
      $window = $(window);
      top = $window.scrollTop() + $window.height() / 10;
      left = $window.scrollLeft();
      $lightbox = $('#lightbox');
      $lightbox.css({
        top: top + 'px',
        left: left + 'px'
      }).fadeIn(this.options.fadeDuration);
      this.changeImage(imageNumber);
    };
 
    Lightbox.prototype.changeImage = function(imageNumber) {
      var $image, $lightbox, preloader,
        _this = this;
      this.disableKeyboardNav();
      $lightbox = $('#lightbox');
      $image = $lightbox.find('.lb-image');
      this.sizeOverlay();
      $('#lightboxOverlay').fadeIn(this.options.fadeDuration);
      $('.loader').fadeIn('slow');
      $lightbox.find('.lb-image, .lb-nav, .lb-prev, .lb-next, .lb-dataContainer, .lb-numbers, .lb-caption').hide();
      $lightbox.find('.lb-outerContainer').addClass('animating');
      preloader = new Image;
      preloader.onload = function() {
        $image.attr('src', _this.album[imageNumber].link);
        $image.width = preloader.width;
        $image.height = preloader.height;
        return _this.sizeContainer(preloader.width, preloader.height);
      };
      preloader.src = this.album[imageNumber].link;
      this.currentImageIndex = imageNumber;
    };
 
    Lightbox.prototype.sizeOverlay = function() {
      return $('#lightboxOverlay').width($(document).width()).height($(document).height());
    };
 
    Lightbox.prototype.sizeContainer = function(imageWidth, imageHeight) {
      var $container, $lightbox, $outerContainer, containerBottomPadding, containerLeftPadding, containerRightPadding, containerTopPadding, newHeight, newWidth, oldHeight, oldWidth,
        _this = this;
      $lightbox = $('#lightbox');
      $outerContainer = $lightbox.find('.lb-outerContainer');
      oldWidth = $outerContainer.outerWidth();
      oldHeight = $outerContainer.outerHeight();
      $container = $lightbox.find('.lb-container');
      containerTopPadding = parseInt($container.css('padding-top'), 10);
      containerRightPadding = parseInt($container.css('padding-right'), 10);
      containerBottomPadding = parseInt($container.css('padding-bottom'), 10);
      containerLeftPadding = parseInt($container.css('padding-left'), 10);
      newWidth = imageWidth + containerLeftPadding + containerRightPadding;
      newHeight = imageHeight + containerTopPadding + containerBottomPadding;
      if (newWidth !== oldWidth && newHeight !== oldHeight) {
        $outerContainer.animate({
          width: newWidth,
          height: newHeight
        }, this.options.resizeDuration, 'swing');
      } else if (newWidth !== oldWidth) {
        $outerContainer.animate({
          width: newWidth
        }, this.options.resizeDuration, 'swing');
      } else if (newHeight !== oldHeight) {
        $outerContainer.animate({
          height: newHeight
        }, this.options.resizeDuration, 'swing');
      }
      setTimeout(function() {
        $lightbox.find('.lb-dataContainer').width(newWidth);
        $lightbox.find('.lb-prevLink').height(newHeight);
        $lightbox.find('.lb-nextLink').height(newHeight);
        _this.showImage();
      }, this.options.resizeDuration);
    };
 
    Lightbox.prototype.showImage = function() {
      var $lightbox;
      $lightbox = $('#lightbox');
      $lightbox.find('.lb-loader').hide();
      $lightbox.find('.lb-image').fadeIn('slow');
      this.updateNav();
      this.updateDetails();
      this.preloadNeighboringImages();
      this.enableKeyboardNav();
    };
 
    Lightbox.prototype.updateNav = function() {
      var $lightbox;
      $lightbox = $('#lightbox');
      $lightbox.find('.lb-nav').show();
      if (this.currentImageIndex > 0) $lightbox.find('.lb-prev').show();
      if (this.currentImageIndex < this.album.length - 1) {
        $lightbox.find('.lb-next').show();
      }
    };
 
    Lightbox.prototype.updateDetails = function() {
      var $lightbox,
        _this = this;
      $lightbox = $('#lightbox');
      if (typeof this.album[this.currentImageIndex].title !== 'undefined' && this.album[this.currentImageIndex].title !== "") {
        $lightbox.find('.lb-caption').html(this.album[this.currentImageIndex].title).fadeIn('fast');
      }
      if (this.album.length > 1) {
        $lightbox.find('.lb-number').html(this.options.labelImage + ' ' + (this.currentImageIndex + 1) + ' ' + this.options.labelOf + '  ' + this.album.length).fadeIn('fast');
      } else {
        $lightbox.find('.lb-number').hide();
      }
      $lightbox.find('.lb-outerContainer').removeClass('animating');
      $lightbox.find('.lb-dataContainer').fadeIn(this.resizeDuration, function() {
        return _this.sizeOverlay();
      });
    };
 
    Lightbox.prototype.preloadNeighboringImages = function() {
      var preloadNext, preloadPrev;
      if (this.album.length > this.currentImageIndex + 1) {
        preloadNext = new Image;
        preloadNext.src = this.album[this.currentImageIndex + 1].link;
      }
      if (this.currentImageIndex > 0) {
        preloadPrev = new Image;
        preloadPrev.src = this.album[this.currentImageIndex - 1].link;
      }
    };
 
    Lightbox.prototype.enableKeyboardNav = function() {
      $(document).on('keyup.keyboard', $.proxy(this.keyboardAction, this));
    };
 
    Lightbox.prototype.disableKeyboardNav = function() {
      $(document).off('.keyboard');
    };
 
    Lightbox.prototype.keyboardAction = function(event) {
      var KEYCODE_ESC, KEYCODE_LEFTARROW, KEYCODE_RIGHTARROW, key, keycode;
      KEYCODE_ESC = 27;
      KEYCODE_LEFTARROW = 37;
      KEYCODE_RIGHTARROW = 39;
      keycode = event.keyCode;
      key = String.fromCharCode(keycode).toLowerCase();
      if (keycode === KEYCODE_ESC || key.match(/x|o|c/)) {
        this.end();
      } else if (key === 'p' || keycode === KEYCODE_LEFTARROW) {
        if (this.currentImageIndex !== 0) {
          this.changeImage(this.currentImageIndex - 1);
        }
      } else if (key === 'n' || keycode === KEYCODE_RIGHTARROW) {
        if (this.currentImageIndex !== this.album.length - 1) {
          this.changeImage(this.currentImageIndex + 1);
        }
      }
    };
 
    Lightbox.prototype.end = function() {
      this.disableKeyboardNav();
      $(window).off("resize", this.sizeOverlay);
      $('#lightbox').fadeOut(this.options.fadeDuration);
      $('#lightboxOverlay').fadeOut(this.options.fadeDuration);
      return $('select, object, embed').css({
        visibility: "visible"
      });
    };
 
    return Lightbox;
 
  })();
 
  $(function() {
    var lightbox, options;
    options = new LightboxOptions;
    return lightbox = new Lightbox(options);
  });
 
}).call(this);



Merci beaucoup