I need to create an array of links for a simple image gallery

I made a website portfolio of paintings.

When the thumbnails click and display a medium-sized photograph of the same image.

I made it as an array, it was pretty simple.

I also added information for each image, like the name and dimensions, again as an array.

I would like to add a link to each image, which will open a new window that will allow the user to view an even image with more detail if they want to. something like a lightbox where the screen dims.

I can not pass the reference to the array, I am sure that this is a simple error. Can someone give us some tips.

+3
source share
1 answer

Javascript Object Notation. JSON. ( JS)

:

var myPaintings = new Array();

var painting = new Object();
painting.medium = "images/blah.jpg";
painting.link = "dosomething.html";
painting.caption = "this is a painting";

myPaintings.push( painting );

json . JSON.stringify() JSON.encode() jquery $.JSON.parseJSON() ..

var myPaintings = {

     [
         { 
             "medium":"images/blah.jpg",
             "link": "dosomething.html",
             "caption":"this is a painting"

         },
         { 
             "medium":"images/hello.jpg",
             "link": "dosomethingelse.html",
             "caption":"this is a painting also"
         }
     ]
}

, , {} myPaintings = [...]. JSON - , JSON . , /.

+2

All Articles