필자의 flickr 갤러리는 코딩되었지만 제작자 이름을 클릭 할 수 있기를 원하면 페이지는 해당 작성자의 이미지만으로 다시로드됩니다. 당신은 지금 당신을 위해 노력하고있는 방법은, 본질은 다음 같은 경우 여기 작성자의 Flickr 요청 다시로드
방금에 대한 하나의 일치하도록$.getJSON
URL을 변경해야 할, 내 현재 코드
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Outbrain Test Gallery</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="jquery.masonry.min.js"></script>
<script type="text/javascript">
$(window).load(function(){
$('#flkr').masonry({
// options
itemSelector : '.tiles',
isResizable: true,
});
});
</script>
<script type="text/javascript">$(document).ready(function() {
$('<ul />').prependTo('#flkr');
$.getJSON('http://api.flickr.com/services/feeds/photos_public.gne?lang=en-us&format=json&jsoncallback=?', function(data) {
$.each(data.items, function(i,item) {
var squares = (item.media.m).replace('_m.jpg', '_q.jpg');
if(i <= 20){
$('<img/>').attr({
alt: item.title,
src: squares,
height: '150',
width: '150'
}).appendTo('#flkr ul').wrap('<li class="tiles"><a href="' + item.link + '"></a><p class="title">' + item.title + '</p><p class="author"><strong>By:</strong> ' + item.author + '</p><p class="date"><strong>Uploaded: </strong>' + item.published + '</p></li>');
}
});
});
});
</script>
</head>
<body>
<ul id="flkr"></ul>
</body>
</html>
URL과 작성자는 모두 Flickr의 최근 게시물 이미지를 가져 오므로 바로 생성되므로 하드 코딩이 불가능합니다. 내가 보는 방법은 'item-author'값을 얻은 다음 getJSON URL의 작성자 ID가있는 페이지를 다시로드하는 것입니다.하지만 그렇게 할 생각이 없습니다. Jquery – user1797325