CreationGalerie » History » Version 3
Simon, 10/14/2014 03:25 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 | h2. Diaporama externe (exemple en mode slide avec SlidesJS) |
||
| 50 | |||
| 51 | 3 | Simon | L'exemple présenté ci-dessous utilise http://www.slidesjs.com/ et plus précisément http://www.slidesjs.com/examples/playing/. |
| 52 | 2 | Simon | |
| 53 | <pre> |
||
| 54 | <code class="javascript"> |
||
| 55 | <p><!-- -- javascript ----></p> |
||
| 56 | <script src="../path/js/Slides-SlidesJS-3/source/jquery.slides.min.js"></script><script> |
||
| 57 | $(function(){ |
||
| 58 | $("#slides").slidesjs({ |
||
| 59 | width: 550, |
||
| 60 | height: 350, |
||
| 61 | play: { |
||
| 62 | active: true, |
||
| 63 | auto: true, |
||
| 64 | interval: 4000, |
||
| 65 | swap: true, |
||
| 66 | pauseOnHover: true, |
||
| 67 | restartDelay: 2500 |
||
| 68 | } |
||
| 69 | }); |
||
| 70 | }); |
||
| 71 | </script> |
||
| 72 | </code> |
||
| 73 | </pre> |
||
| 74 | |||
| 75 | Et pour la partie HTML : |
||
| 76 | <pre> |
||
| 77 | <code class="html"> |
||
| 78 | <div class="slideshow-container"> |
||
| 79 | <div id="slides"> |
||
| 80 | <img class="nomouseover" src="http://placehold.it/550x350" /> |
||
| 81 | <img class="nomouseover" src="http://placehold.it/550x350" /> |
||
| 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 | </div> |
||
| 86 | 1 | Simon | </div> |
| 87 | 3 | Simon | </code> |
| 88 | </pre> |
||
| 89 | |||
| 90 | |||
| 91 | Code CSS utilisé : |
||
| 92 | <pre> |
||
| 93 | <code class="css"> |
||
| 94 | /* |
||
| 95 | * Slides-SlidesJS-3 */ |
||
| 96 | |||
| 97 | .slideshow-container {margin:0;} |
||
| 98 | |||
| 99 | #slides { |
||
| 100 | display: none |
||
| 101 | } |
||
| 102 | |||
| 103 | #slides .slidesjs-navigation { |
||
| 104 | margin-top:5px; |
||
| 105 | } |
||
| 106 | |||
| 107 | a.slidesjs-next, |
||
| 108 | a.slidesjs-previous, |
||
| 109 | a.slidesjs-play, |
||
| 110 | a.slidesjs-stop { |
||
| 111 | background-image: url(../js/Slides-SlidesJS-3/examples/playing/img/btns-next-prev.png); |
||
| 112 | background-repeat: no-repeat; |
||
| 113 | display:block; |
||
| 114 | width:12px; |
||
| 115 | height:18px; |
||
| 116 | overflow: hidden; |
||
| 117 | text-indent: -9999px; |
||
| 118 | float: left; |
||
| 119 | margin-right:5px; |
||
| 120 | } |
||
| 121 | |||
| 122 | a.slidesjs-next { |
||
| 123 | margin-right:10px; |
||
| 124 | background-position: -12px 0; |
||
| 125 | } |
||
| 126 | |||
| 127 | a:hover.slidesjs-next { |
||
| 128 | background-position: -12px -18px; |
||
| 129 | } |
||
| 130 | |||
| 131 | a.slidesjs-previous { |
||
| 132 | background-position: 0 0; |
||
| 133 | } |
||
| 134 | |||
| 135 | a:hover.slidesjs-previous { |
||
| 136 | background-position: 0 -18px; |
||
| 137 | } |
||
| 138 | |||
| 139 | a.slidesjs-play { |
||
| 140 | width:15px; |
||
| 141 | background-position: -25px 0; |
||
| 142 | } |
||
| 143 | |||
| 144 | a:hover.slidesjs-play { |
||
| 145 | background-position: -25px -18px; |
||
| 146 | } |
||
| 147 | |||
| 148 | a.slidesjs-stop { |
||
| 149 | width:18px; |
||
| 150 | background-position: -41px 0; |
||
| 151 | } |
||
| 152 | |||
| 153 | a:hover.slidesjs-stop { |
||
| 154 | background-position: -41px -18px; |
||
| 155 | } |
||
| 156 | |||
| 157 | .slidesjs-pagination { |
||
| 158 | margin: 7px 0 0; |
||
| 159 | float: right; |
||
| 160 | list-style: none; |
||
| 161 | } |
||
| 162 | |||
| 163 | .slidesjs-pagination li { |
||
| 164 | float: left; |
||
| 165 | margin: 0 1px; |
||
| 166 | } |
||
| 167 | |||
| 168 | .slidesjs-pagination li a { |
||
| 169 | display: block; |
||
| 170 | width: 13px; |
||
| 171 | height: 0; |
||
| 172 | padding-top: 13px; |
||
| 173 | background-image: url(../js/Slides-SlidesJS-3/examples/playing/img/pagination.png); |
||
| 174 | background-position: 0 0; |
||
| 175 | float: left; |
||
| 176 | overflow: hidden; |
||
| 177 | } |
||
| 178 | |||
| 179 | .slidesjs-pagination li a.active, |
||
| 180 | .slidesjs-pagination li a:hover.active { |
||
| 181 | background-position: 0 -13px |
||
| 182 | } |
||
| 183 | |||
| 184 | .slidesjs-pagination li a:hover { |
||
| 185 | background-position: 0 -26px |
||
| 186 | } |
||
| 187 | |||
| 188 | #slides a:link, |
||
| 189 | #slides a:visited { |
||
| 190 | color: #333 |
||
| 191 | } |
||
| 192 | |||
| 193 | #slides a:hover, |
||
| 194 | #slides a:active { |
||
| 195 | color: #9e2020 |
||
| 196 | } |
||
| 197 | |||
| 198 | 1 | Simon | </code> |
| 199 | </pre> |