Skip to content

Instantly share code, notes, and snippets.

@kkung
Created August 4, 2011 10:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kkung/1124943 to your computer and use it in GitHub Desktop.
Save kkung/1124943 to your computer and use it in GitHub Desktop.
daum image search
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8">
window._page = 1;
var fetcher = function(page) {
var query = '';
var apikey = '';
var url = 'http://apis.daum.net/search/image?q='+query+'&apikey='+apikey+'&output=json&pageno='+page+'&callback=?'
$.getJSON(url, function(data) {
var div = $("#result");
div.append('<hr />');
for ( var i = 0 ; i < data.channel.item.length; i++ ) {
item = data.channel.item[i];
div.append($("<img src='" + item.image + "' />"));
}
});
}
$(document).ready(function() {
fetcher(window._page);
});
$(window).scroll(function() {
if ( $(window).scrollTop() == $(document).height() - $(window).height()) {
fetcher(++window._page);
}
})
</script>
</head>
<body>
<div id="result">
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment