有人可以解释jquery ui照片管理器示例代码吗?
答
// image recycle function
var trash_icon = '<a href="link/to/trash/script/when/we/have/js/off" title="Delete this image" class="ui-icon ui-icon-trash">Delete image</a>';
function recycleImage($item) {
// fade the item out
$item.fadeOut(function() {
// when the item is done fading remove the refresh icon
$item.find('a.ui-icon-refresh').remove();
// then set the width of the item
$item.css('width','96px')
//add the trash icon to the item in place of the recycle icon
.append(trash_icon)
//Then find the image and set the height on that
.find('img').css('height','72px')
//Back to the item and append it to the gallery
.end().appendTo($gallery)
//fade it back in
.fadeIn();
});
}
废纸篓图标的href被设想为在javascript关闭时可以工作的url。这个想法是,当你拖动东西,然后点击你最可能发出Ajax请求的图标,将这些操作保存在服务器上。当用户关闭javascript时,应该可以使用这些相同的操作。
+0
谢谢! 你能解释一下这个链接如何链接 ' user16455 2010-03-25 04:13:53
+0
更新了答案,并附有垃圾桶图标href的简短描述 – PetersenDidIt 2010-03-25 11:13:48
链接不工作? – Bermo 2010-03-25 01:14:43