Good evening! There is a function

<script type="text/javascript"> function setBigImage(foto) { $("#adpdp14").attr('href', $(foto).parent('.it').children('a').attr('href')); document.getElementById("dp14").src = foto.src; } </script> 

and initialization second

 <script> $(function() { $(a.fullsizable).fullsizable({ clickBehaviour: 'next' }); }); </script> 

and the div structure itself (sets the first big div to the miniatures that you click on in the lower div)

 <div class="photo"> <div class="img"> <a href="1.jpg" id="adpdp14" class="fullsizable" onclick='fullsizable(this);'><img src="1.jpg" id="dp14" /></a> </div> <div class="thumbs" > <div class="it"><a style="display:none;" href="1.jpg" rel="example_group" ></a> <img src="1.jpg" onclick='setBigImage(this);' alt="" /></div> <div class="it"><a style="display:none;" href="2.jpg" rel="example_group" class="fullsizable"></a> <img src="2.jpg" onclick='setBigImage(this);' alt="" /></div> <div class="it"><a style="display:none;" href="3.jpg" rel="example_group" class="fullsizable"></a> <img src="3.jpg" onclick='setBigImage(this);' alt="" /></div> <div class="it"><a style="display:none;" href="4.jpg" rel="example_group" class="fullsizable"></a> <img src="4.jpg" onclick='setBigImage(this);' alt="" /></div> </div> 

How to grow both functions, how to make the initialization of the second not by the <a> tag with the class .fullsizable, but by the value that id = "adpdp14" changes from the first function and at the same time that the pictures are scrolled and not just opened in the top div ' e current address id = "adpdp14"?

  • To start, do not do this: <a href="1.jpg" id="adpdp14" class="fullsizable" onclick='fullsizable(this);'> - zb <a href="1.jpg" id="adpdp14" class="fullsizable" onclick='fullsizable(this);'>
  • @eicto, I saw, you wrote a lot where you couldn’t use such constructions onclick = 'setBigImage (this);'. And why? - mountpoint
  • Well, I have already written in detail: * called functions in the global; * jQuery (and here it is he) uses its own stream of events, which will be so broken; * specifically here also DRY . - zb '
  • @eicto, everything is clear. - mountpoint
  • one
    @mountpoint, ru.wikipedia.org/wiki/ ... @besimpl, did not quite understand your problem. Do you need when clicking on a thumbnail to show this picture in the top diva? And it scares me to use document.getElementById with jQuery, why? - andreyqin

0