I am building a site called DrawSome, which needs to display 2 random images for people to fuse through drawing.
On the picture you see the basic display of the site. I want the user to be able to load 2 new images in the boxes, when clicking on the button. It is important only the image-boxes refreshes, and not the whole site. My idea was to pull the images from lorempixel.com, so I don't have to create a database.
Which script do I use to create the refresh in the window only? jQuery?
How do I go around making this simple function?
So far I only have this, which do not solve my problem. It only pulls the images locally, and do not refresh the image windows.
var changeImg = function(){
$('.btn').click(function(){
$('.random_img').css({'content': 'url(images/img' + Math.floor(Math.random()*(3-1+1)+1) +'.jpg)'});
});
};
$(document).ready(changeImg);
Hope you consider this rookie question - we all have to start somewhere.
All the best, Esben