image - jQuery picture load -
I need some help in jQuery What I want to do is create a small, very, very easy picture gallery of some kind.
I have to do some small pictures on the left hand side of my page. By clicking on one of these small images, I would like to load this photo in another device where it is shown in full size.
& lt; A href = "image1_big.jpg" square = "small-small" /> & Lt; Img src = "image1_small" /> gt; & Lt; / A & gt; & Lt; A href = "image2_big.jpg" class = "small" / "gt; & lt; img src =" image2_small "/> gt; & lt; / a & gt; & lt; a href =" image3_big.jpg "class = "Small" ">"> gt; & lt; / a & gt; & lt; div id = "bigpic" /> gt; & lt; img src = "Image1_big" />
All of my jQuery attempts failed because I could not change the source of the image within this large piece of media.
This should do for you:
$ (function () {$ (".smallpics") (function (e) {$ ("# bigpic"). Html ('& lt; img src = "' ++"); Stop defaults ();});});
I could also use it (instead of the same row in the previous example):
$ ("# bigpic") empty () .append ($ ("(lt; img) />").attr('src ', this.href));
But the first option will actually execute it a bit faster with only one call to tell you the difference So if the option is easy to read or write two, you can use it.
Comments
Post a Comment