[英]How to feed to “The Wall” moo tools plugin JSON data?
我设想了这个名为“The Wall”的插件,但遗憾的是,文档和示例都没有显示如何向它提供JSON对象。
假设我们有JSON数组,如:
[
{
href : "/my/photo/image1.jpg",
title : "Me and Sara"
},
{
href : "/my/photo/image2.jpg",
title : "Me and Sara on a trip"
},
{
href : "/my/photo/image3.jpg",
title : "Me and Sara on a vacation"
}
]
(它可以而且应该更大)但我希望你明白这一点。 如何使“The Wall”用这样的JSON创建一个图像墙?
就像是:
var images = [
{
href : "/my/photo/image1.jpg",
title : "Me and Sara"
},
{
href : "/my/photo/image2.jpg",
title : "Me and Sara on a trip"
},
{
href : "/my/photo/image3.jpg",
title : "Me and Sara on a vacation"
}
];
var counterFluid = 1;
var maxLength = images.length;
var wallFluid = new Wall("wall", {
"draggable":true,
"inertia":true,
"width":150,
"height":150,
"rangex":[-100,100],
"rangey":[-100,100],
callOnUpdate: function(items){
items.each(function(e, i){
var a = new Element("img[src=" + images[(counterFluid -1)].href + "]");
a.inject(e.node).fade("hide").fade("in");
counterFluid++;
// Reset counter
if( counterFluid > maxLength ) counterFluid = 1;
})
}
});
// Init Fluid Wall
wallFluid.initWall();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.