CreationGalerie » History » Version 4
Simon, 10/14/2014 03:26 PM
| 1 | 1 | Simon | h1. Création d'une galerie d'images |
|---|---|---|---|
| 2 | |||
| 3 | 2 | Simon | h2. Diaporama natif (en mode _overlay_) |
| 4 | |||
| 5 | 1 | Simon | Linea21 utilise par défaut le plugin jquery Colorbox |
| 6 | |||
| 7 | Pour créer une galerie il suffit, *directement depuis l'éditeur WYSIWYG,* de déclarer les instructions javascript suivantes : |
||
| 8 | |||
| 9 | <pre> |
||
| 10 | <code class="javascript"> |
||
| 11 | <p><!-- -- javascript ----></p> |
||
| 12 | $(function(){ |
||
| 13 | $(".slideshow").colorbox({ |
||
| 14 | rel:'slideshow', |
||
| 15 | slideshow:true, |
||
| 16 | slideshowStart: "Démarrer le diaporama", |
||
| 17 | slideshowStop: "Stopper le diaporama", |
||
| 18 | slideshowSpeed: 3000, |
||
| 19 | current: "image {current} de {total}", |
||
| 20 | previous: "précédent", |
||
| 21 | next: "suivant", |
||
| 22 | close: "fermer", |
||
| 23 | }); |
||
| 24 | }); |
||
| 25 | |||
| 26 | </script> |
||
| 27 | </code> |
||
| 28 | </pre> |
||
| 29 | |||
| 30 | et le code HTML suivant : |
||
| 31 | |||
| 32 | <pre> |
||
| 33 | <code class="html"> |
||
| 34 | <p><a alt="yop" class="slideshow" href="../library/userfiles/images/images_DSC02023.jpg"><img class="nomouseover" src="../library/userfiles/images/images_DSC02023.jpg" style="height: 200px; width: 300px;" /></a></p> |
||
| 35 | |||
| 36 | <div id="slides2" style="display:none"> |
||
| 37 | <p><a class="slideshow" href="../library/userfiles/images/images_DSC02030.jpg" title="yop">test</a></p> |
||
| 38 | |||
| 39 | <p><a class="slideshow" href="../library/userfiles/images/images_DSC02046.jpg" title="yop 2">test 2</a></p> |
||
| 40 | |||
| 41 | <p><a class="slideshow" href="../library/userfiles/images/images_DSC02053.jpg" title="yop 3">test 3</a></p> |
||
| 42 | 2 | Simon | </div> |
| 43 | </code> |
||
| 44 | </pre> |
||
| 45 | |||
| 46 | La page ainsi créer affichera une image cliquable. Au clic, le diaporama sera automatiquement lancer. |
||
| 47 | |||
| 48 | |||
| 49 | 4 | Simon | |
| 50 | |||
| 51 | 2 | Simon | h2. Diaporama externe (exemple en mode slide avec SlidesJS) |
| 52 | |||
| 53 | 3 | Simon | L'exemple présenté ci-dessous utilise http://www.slidesjs.com/ et plus précisément http://www.slidesjs.com/examples/playing/. |
| 54 | 2 | Simon | |
| 55 | <pre> |
||
| 56 | <code class="javascript"> |
||
| 57 | <p><!-- -- javascript ----></p> |
||
| 58 | <script src="../path/js/Slides-SlidesJS-3/source/jquery.slides.min.js"></script><script> |
||
| 59 | $(function(){ |
||
| 60 | $("#slides").slidesjs({ |
||
| 61 | width: 550, |
||
| 62 | height: 350, |
||
| 63 | play: { |
||
| 64 | active: true, |
||
| 65 | auto: true, |
||
| 66 | interval: 4000, |
||
| 67 | swap: true, |
||
| 68 | pauseOnHover: true, |
||
| 69 | restartDelay: 2500 |
||
| 70 | } |
||
| 71 | }); |
||
| 72 | }); |
||
| 73 | </script> |
||
| 74 | </code> |
||
| 75 | </pre> |
||
| 76 | |||
| 77 | Et pour la partie HTML : |
||
| 78 | <pre> |
||
| 79 | <code class="html"> |
||
| 80 | <div class="slideshow-container"> |
||
| 81 | <div id="slides"> |
||
| 82 | <img class="nomouseover" src="http://placehold.it/550x350" /> |
||
| 83 | <img class="nomouseover" src="http://placehold.it/550x350" /> |
||
| 84 | <img class="nomouseover" src="http://placehold.it/550x350" /> |
||
| 85 | <img class="nomouseover" src="http://placehold.it/550x350" /> |
||
| 86 | <img class="nomouseover" src="http://placehold.it/550x350" /> |
||
| 87 | </div> |
||
| 88 | 1 | Simon | </div> |
| 89 | 3 | Simon | </code> |
| 90 | </pre> |
||
| 91 | |||
| 92 | |||
| 93 | Code CSS utilisé : |
||
| 94 | <pre> |
||
| 95 | <code class="css"> |
||
| 96 | /* |
||
| 97 | * Slides-SlidesJS-3 */ |
||
| 98 | |||
| 99 | .slideshow-container {margin:0;} |
||
| 100 | |||
| 101 | #slides { |
||
| 102 | display: none |
||
| 103 | } |
||
| 104 | |||
| 105 | #slides .slidesjs-navigation { |
||
| 106 | margin-top:5px; |
||
| 107 | } |
||
| 108 | |||
| 109 | a.slidesjs-next, |
||
| 110 | a.slidesjs-previous, |
||
| 111 | a.slidesjs-play, |
||
| 112 | a.slidesjs-stop { |
||
| 113 | background-image: url(../js/Slides-SlidesJS-3/examples/playing/img/btns-next-prev.png); |
||
| 114 | background-repeat: no-repeat; |
||
| 115 | display:block; |
||
| 116 | width:12px; |
||
| 117 | height:18px; |
||
| 118 | overflow: hidden; |
||
| 119 | text-indent: -9999px; |
||
| 120 | float: left; |
||
| 121 | margin-right:5px; |
||
| 122 | } |
||
| 123 | |||
| 124 | a.slidesjs-next { |
||
| 125 | margin-right:10px; |
||
| 126 | background-position: -12px 0; |
||
| 127 | } |
||
| 128 | |||
| 129 | a:hover.slidesjs-next { |
||
| 130 | background-position: -12px -18px; |
||
| 131 | } |
||
| 132 | |||
| 133 | a.slidesjs-previous { |
||
| 134 | background-position: 0 0; |
||
| 135 | } |
||
| 136 | |||
| 137 | a:hover.slidesjs-previous { |
||
| 138 | background-position: 0 -18px; |
||
| 139 | } |
||
| 140 | |||
| 141 | a.slidesjs-play { |
||
| 142 | width:15px; |
||
| 143 | background-position: -25px 0; |
||
| 144 | } |
||
| 145 | |||
| 146 | a:hover.slidesjs-play { |
||
| 147 | background-position: -25px -18px; |
||
| 148 | } |
||
| 149 | |||
| 150 | a.slidesjs-stop { |
||
| 151 | width:18px; |
||
| 152 | background-position: -41px 0; |
||
| 153 | } |
||
| 154 | |||
| 155 | a:hover.slidesjs-stop { |
||
| 156 | background-position: -41px -18px; |
||
| 157 | } |
||
| 158 | |||
| 159 | .slidesjs-pagination { |
||
| 160 | margin: 7px 0 0; |
||
| 161 | float: right; |
||
| 162 | list-style: none; |
||
| 163 | } |
||
| 164 | |||
| 165 | .slidesjs-pagination li { |
||
| 166 | float: left; |
||
| 167 | margin: 0 1px; |
||
| 168 | } |
||
| 169 | |||
| 170 | .slidesjs-pagination li a { |
||
| 171 | display: block; |
||
| 172 | width: 13px; |
||
| 173 | height: 0; |
||
| 174 | padding-top: 13px; |
||
| 175 | background-image: url(../js/Slides-SlidesJS-3/examples/playing/img/pagination.png); |
||
| 176 | background-position: 0 0; |
||
| 177 | float: left; |
||
| 178 | overflow: hidden; |
||
| 179 | } |
||
| 180 | |||
| 181 | .slidesjs-pagination li a.active, |
||
| 182 | .slidesjs-pagination li a:hover.active { |
||
| 183 | background-position: 0 -13px |
||
| 184 | } |
||
| 185 | |||
| 186 | .slidesjs-pagination li a:hover { |
||
| 187 | background-position: 0 -26px |
||
| 188 | } |
||
| 189 | |||
| 190 | #slides a:link, |
||
| 191 | #slides a:visited { |
||
| 192 | color: #333 |
||
| 193 | } |
||
| 194 | |||
| 195 | #slides a:hover, |
||
| 196 | #slides a:active { |
||
| 197 | color: #9e2020 |
||
| 198 | } |
||
| 199 | |||
| 200 | 1 | Simon | </code> |
| 201 | </pre> |