0
这是“我的代码”从Facebook拉取图像并显示它们。Facebook上的图像在网站上,编辑jquery
但我想包装图像周围< A HREF = “image.source” 级= “highslide” 的onclick =“返回hs.expand(本)>
请帮我输出:
<a href="image.source" class="highslide" onclick="return hs.expand(this)>
<img src"image.source" width="167" height="167">
</a>
原始代码:
<script type="text/javascript" src="underscore-min.js"></script>
<script type="text/javascript">
$.getJSON('http://graph.facebook.com/261512740659107/photos').then(function (response) {
// 0-8, 0 returns the largest available images, 8 the smallest
var imageIndex = 4;
var images = _(response.data)
.chain()
.pluck('images')
.pluck(imageIndex)
.value();
console.log(images);
_(images).each(function (image) {
$('#image-container').append(
$('<img>').attr('src', image.source).attr('height', 167).attr('width', 167));
});
});
</script>
非常感谢。现在正在工作。 –