Created
September 28, 2018 21:19
-
-
Save thejungwon/1dd39f50d4b78c8ae07f1a808227e1d5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function newimage(keyword){ | |
if(!ACCESS_KEY){ | |
alert("Please update your access key"); | |
return; | |
} | |
var url = `https://api.unsplash.com/search/photos?query=${keyword}&per_page=20&orientation=landscape&client_id=${ACCESS_KEY}`; | |
$.get(url,function(data){ | |
var picture_url = data.results[0].urls.raw; | |
setCookie("picture",picture_url); | |
$('body').css('background-image',`url(${picture_url})`); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment