Hi,
im using the code below to load instagram images then I'm giving them a random width.
Id like to alter the random with function so that there's only 2 different values to randomize. E.g all images ('maxWidth') will either become 200px or 300px.
HTML Code:$.ajax({ type: "GET", dataType: "jsonp", cache: false, url: "https://api.instagram.com/v1/users/178173879/media/recent/?access_token=178173879.e651f2a.16d3f37736f24149b6cca8b03e2ace79", success: function(data) { for (var i = 0; i < 10; i++) { maxWidth = Math.floor(115 + (Math.random() * 135)); $("#container_content").append("<div class='instagram item'> <a target='_blank' href='" + data.data[i].link + "'><img src='" + data.data[i].images.low_resolution.url +"' width='" + maxWidth + "' /></img></a></div>"); } } });


Reply With Quote
Bookmarks