November 23, 201115 yr Hi there, I'm a photographer who has some knowledge of web design. I'm looking to create a website to display my work. I'm really liking this site http://www.jasonevans.info/ but am unsure how to crate one similar. I'd like my images to move around when the page is shrunk/stretch as well as having the randomise button at the bottom of the page. Could anyone explain to to create ese? or how the person who created the jason evans site did it? any help would be really appreciated!!! Inamoto Edited November 23, 201115 yr by INAMOTO
November 23, 201115 yr They have added this javascript... <script type="text/javascript"> //<![CDATA[ var totalPics = 754; var numRandPics = 30; var imgFolder = 'images/'; //load the paths to the pics var picPaths = new Array(); for(var i=0; i < totalPics; i=i+1) { picPaths[i] = imgFolder+'Jason_Evans_'+(i+1)+'.jpg'; } //display the random images var randNums = new Array(); window.onload=function() { var randNum; var picO = new Array(); //store the preloaded images //generate unique random numbers and display their pics for(var i=0; i < numRandPics; i=i+1) { do { randNum = Math.floor(Math.random()*picPaths.length) } while(is_in_array(randNum)); //this number already used - so generate another. randNums.push(randNum); //store the random numbers used so far //preload the random image picO[i] = new Image(); picO[i].src = picPaths[randNum]; //create the <img> for this pic imgElem = document.createElement("img"); imgElem.setAttribute("src", picO[i].src); imgElem.setAttribute("alt", ''); imgElem.setAttribute("class", 'wallPics'); document.getElementById("container").appendChild(imgElem); } } //helper function function is_in_array(num) { var isNumInArray = false; for(var i=0; i < randNums.length; i=i+1) { if(num == randNums[i]) { isNumInArray = true; i = randNums.length; } } return isNumInArray; } //]]> </script> ...to the <head> of the page, then added loads of images to a folder called "images" (without quotes). Then added a refresh button to the bottom of the page. Edited November 23, 201115 yr by Bomb
November 23, 201115 yr Author hey thanks a lot! you're a great help! Do you have an idea how to create the refresh button? much appreciated!
November 24, 201115 yr I would add some text though, i find the site very uninspiring and does not do the images justice. Who are you, what do you do and why, these are important bits of info.
November 24, 201115 yr hey thanks a lot! you're a great help! Do you have an idea how to create the refresh button? much appreciated! This is how it was achieved on the example site. Add this where you want the button to appear... <a href="javascript:history.go(0)"><img alt="more" src="url of your image"></a> Obviously changing the url of your image. Edited November 24, 201115 yr by Bomb
Create an account or sign in to comment