$.ajax({url: "./=about-screen-contest/contest-for-10/json/", dataType:"json"}).done(function(json) {
var container = $("#wrapper");
var grid = $("<div />" ,{id:"grid"});
grid.appendTo(container);
for(var i = 0; i < json['object_list'].length; i++) {
var item = json['object_list'][i];
//if (item.verified) {
var downloadimage = $('<img data-number="'+i+'">');
downloadimage.on("load", function () {
var item = json['object_list'][$(this).data("number")];
grid.append('<div><image class="contest" data-date="' + item.created + '" title="' + item.name + '" alt="About Screen 1.0 by ' + item.user + '" src="' + $(this).attr("src") + '" /><div class="tooltip"><h1>' + item.name + '</h1><h2>' + item.user + '</h2><p>' + item.desc + '</p></div></div>');
});
downloadimage.attr("src", item.download);
//}
}
});
var prevpos = 0;
$("body").on("click", ".tooltip", function () {
if (!$("#wrapper").hasClass("insensitive")) {
prevpos = $("html").scrollTop();
$("html").scrollTop(0);
var factor = 750/625;
$("#wrapper").css("height",$(window).height() - 40);
$("#wrapper").addClass("insensitive");
$("body").addClass("open");
$("#grid").css("opacity", "0");
$("html").css("background-color","#fff");
$("#wrapper").css("background-image","url(" + $(this).prev().attr("src") + ")");
}
})
$("body").on("click", ".insensitive", function () {
$("html").scrollTop(prevpos);
var factor = 750/625;
$("#wrapper").css("min-height",$(window).height() - 40);
//$("#wrapper").css("min-height",$("body").height() / factor);
$("#wrapper").removeClass("insensitive");
$("body").removeClass("open");
$("#grid").css("opacity", "1");
$("html").css("background-color","#000");
$("#wrapper").css("background-image","none");
$("#wrapper").css("height","auto");
})
Screen Contest JS toy loader
コメントするにはログインしてください!