I used javascript to upload the image to my site, depending on which "small" photos you selected in ul ... I had something like this:
<script type="text/javascript"> function viewImage(src, legende) { document.getElementById("imageBig").src = "images/photos/"+src; document.getElementById("legend").innerHTML = legende; } </script>
and in html just: things like this:
<ul id="ulPhotos"> <li> <a href="#centre" onclick="javascript:viewImage('flute.jpg','La Reine de la Nuit au Comedia')"> <img src="images/photos/carre-09.jpg" alt="" /> </a> <a href="#centre" onclick="javascript:viewImage('perichole.jpg','Manuelita - <em>La Périchole</em> à l’Opéra Comique')"> <img src="images/photos/carre-03.jpg" alt="" /> </a> </li> <li> <a href="#centre" onclick="javascript:viewImage('12.png','Récital à Carnac, septembre 2008')"> <img src="images/photos/carre-12.jpg" alt="Marion Baglan Carnac Ré" /> </a> <a href="#centre" onclick="javascript:viewImage('01.jpg','')"> <img src="images/photos/carre-01.jpg" alt="" /> </a> </li> </ul>
so that you can see, depending on what small photos in the unordered list you clicked, upload some specific photos by passing the src line in the argument of my viewImage function ...
but I decided to use jQuery to get a gradual decrease effect. But I can't find a way to pass an argument that will tell my jQuery function which photo to upload depending on where I clicked ...
stuck here:
$(document).ready(function(){ $('#ulPhotos').click(function() { var newSrc = $('#imageBig').attr("src", "images/photos/11.jpg"); }); });
I don't want 11.jpg to be hardcoded, I need to pass it through an argument when I click on the special li element in my ul id #ulPhotos element ...
I hope I'm so sorry!
javascript jquery html
KitAndKat
source share