使用Javascript和Facebook图形API的可点击图像
我有一段代码:使用Javascript和Facebook图形API的可点击图像,javascript,json,facebook,facebook-graph-api,photo,Javascript,Json,Facebook,Facebook Graph Api,Photo,我有一段代码: function fbFetch(){ //Set Url of JSON data from the facebook graph api. make sure callback is set with a '?' to overcome the cross domain problems with JSON var url = "http://graph.facebook.com/10150171084863204/photos?limit=3&
function fbFetch(){
//Set Url of JSON data from the facebook graph api. make sure callback is set with a '?' to overcome the cross domain problems with JSON
var url = "http://graph.facebook.com/10150171084863204/photos?limit=3&type=small&callback=?";
//Use jQuery getJSON method to fetch the data from the url and then create our unordered list with the relevant data.
$.getJSON(url,function(json){
var html = "<ul>";
html += '<li><img src="foto.jpg" /></li>';
//loop through and within data array's retrieve the message variable.
$.each(json.data,function(i,fb){
html += '<li><img class="fbimg" alt="" src="' + fb.picture + '" /></li>';
});
html += '<li><a href=""><img src="fotolain.jpg" border="0" /></a></li>';
html += "</ul>";
$('.facebookfeed').html(html);
});
};
函数fbFetch(){
//设置facebook graph api中JSON数据的Url。确保回调设置为“?”,以克服JSON的跨域问题
变量url=”http://graph.facebook.com/10150171084863204/photos?limit=3&type=small&callback=?";
//使用jQuery getJSON方法从url获取数据,然后使用相关数据创建无序列表。
$.getJSON(url,函数(json){
var html=“”;
html+='';
//在数据数组中循环并检索消息变量。
$.each(json.data,函数(i,fb){
html+='';
});
html+='';
html+=“
”;
$('.facebookfeed').html(html);
});
};
这张图片将从Facebook相册中生成3张图片。我希望每个图像都是可点击的,当用户点击图像时,Facebook相册中的大图像就会显示出来
现在我该如何实现这一点呢?
<a href="path-to-your-big-image.jpg"><img src="path-to-your-small-image.jpg"/></a>
就这么简单。现在你可以在任何地方整合这个想法。无论是FBAPI还是其他地方