나는 tumblr의 v1 json API를 사용하여 게시물에서 이미지를 가져 왔으며이 부분은 잘 작동합니다. 그러나 Im이주기 2 플러그 접속 식을 방아쇠를 당길 수 없으면, 일단이 심상이 dom으로두면 - 그것은 너무 빨리 발사하는 것처럼 보인다. http://jsfiddle.net/orionrush/9XEw2/dom2.axs가 ajax를 통해로드되기 전에 실행됩니다.
을 감안할 때 내 예는 사람이 왜 작동하지 않습니다에 관한 올바른 방향으로 날 지점 수 있습니다 여기에
는 작업 바이올린입니까? 많은 감사 한마디로
나는 이미지를 가져오고 다음으로 DOM에 그들을 배치 :var Tumblr = Tumblr || {};
Tumblr.RecentPhotos = function(el, postsCount, tagged) {
var apiUrl = "http://2014frames.tumblr.com/api/read/json?callback=?&filter=text&type=photo&num=" + (postsCount || 10) + "&tagged=" + tagged;
//var apiUrl = "http://" + document.domain + "/api/read/json?callback=?&filter=text&type=photo&num=" + (postsCount || 10)+ "&tagged=" + tagged;
var renderPosts = function(posts) {
return $.map($.map(posts, postInfo), renderPost);
};
var renderPost = function(post) {
//return "<div><a href='" + post.url + "' ><img src='" + post.src + "' width='500' data-cycle-title='"+ post.title + "' /><div class='cycle-overlay'>" + post.title + "</div></a></div>";
return "<div><img src='" + post.src + "' width='100%' data-cycle-title='"+ post.title + "' /><div class='cycle-overlay'>" + post.title + "</div></div>";
};
var postInfo = function(post) {
console.log(post.photos[0]);
return {
title: post.photos[0]['caption'],
url: post["url"],
height: post.photos[0]['height'],
src: post.photos[0]['photo-url-500']
};
};
return {
render: function() {
$.getJSON(apiUrl, function(data) {
$("<div class='cycle-slideshow composite-example' data-cycle-fx=fadeout data-cycle-timeout=0 data-cycle-loader=wait data-cycle-auto-height=container data-cycle-slides='> div' >").appendTo($(el)).append(renderPosts(data.posts).join("\n"));
});
return this;
}
}
};
그리고 다음으로 모든 트리거 :
jQuery(function() { new Tumblr.RecentPhotos(jQuery(".slideshow"),10 ,"news").render(), function(){$(".cycle-slideshow").cycle();} });
이제이 문제를 해결하려고합니다.하지만 Tumblr 직원/지원팀에서 API의 V1 사용을 중단하는 것에 대해 반복적으로 언급했기 때문에주의해야합니다. – Ally
API에 대해 들었지만, JSON 등으로 꽤 새로 말해서 알 수 있습니다. 새로운 API에는 복잡성이 추가됩니다. 이 포스트를 올려 놓기 때문에 웹 사이트를 운영하는 사람들은 게시하는 방식이 약간 바뀌어 단일 이미지가 아직 나오지 않았습니다. – orionrush