javascript - how to generalize a click function in jquery -


I have 13 small pictures and 13 large pictures, if any small picture is clicked, it will show a big picture related to it. I was wondering if it is possible to normalize the click function, so I do not have to repeat the DIM code 13 times, thanks

   & Lt; Img id = "s2" square = "small" src = "picture / press / small / 2.png" /> & Lt; Img id = "s3" square = "small" src = "picture / press / small / 3.png" /> & Lt; Img id = "s4" class = "small" src = "picture / press / small / png" /> ..... & lt; Img id = "s13" square = "small" src = "picture / press / small / 13.png" /> & Lt; / Div & gt; & Lt; Div class = "big" & gt; & Lt; An id = "off" & gt; X & lt; / A & gt; & Lt; Img id = "b1" src = "picture / press / large / 1.jpg" /> ...... & lt; Img id = "b13" src = "images / press / big / 13.jpg" /> & Lt; / Div & gt; $ ("# S1"). Click (function () ($ ('# b1'). Show (); $ ('big'). Show (300); Return Back;});  

So I was wondering if I could change $ ("# s1"). Click (function ()) so I do not have to repeat it 13 times.

<

<< / p> << div>

"post-text" itemprop = "text">

:

  $ ("('s', ''); $ ('.hard IMG'); Hide ($); $ ('# B' + id_img) .show (); $ ('.bg'). Show (300); Return;});  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

jquery - SimpleModal Confirm fails to submit form -