我有一个portlet,在更新(移动portlet)时将其添加到元素中,但由于某种原因,ui-icon-pencil
元素在每次移动时都会保持重复。
如何阻止这种情况发生?
以下是我要添加到portlet的内容:
$(".portlet").addClass("ui-widget ui-widget-content ui-helper-clearfix ui-corner-all")
.find(".portlet-header")
.addClass("ui-widget-header ui-corner-all")
.prepend("<span style='float:right; margin-right: 17px;' class='ui-icon ui-icon-pencil portlet-edit'></span><span class='ui-icon ui-icon-minusthick portlet-toggle'></span>");
事件处理程序:
函数UpdateUI(){ $( “列”)。排序({ connectWith:“。column”, 句柄:“。portlet-header”, 取消:“。portlet-toggle”, 占位符:“portlet-placeholder ui-corner-all”,
// When Story status changed.
receive: function (event, ui) {
var sourceList = ui.sender; // Story origin
var targetList = $(this); // Story destination
var itemID = $(ui.item).attr("id"); // UserStoryID
UpdateStoryStatus(itemID, sourceList, targetList);
},
// On portlet moved.
update: function (event, ui) {
UpdateStoryOrder();
}
});
$('input:checkbox').change(
function () {
var isChecked;
if ($(this).is(':checked')) { isChecked = true; }
else { isChecked = false; }
var type = $(this).attr('id');
var reqID = $(this).closest('.req').attr('id');
UpdateReqStatus(reqID, type, isChecked);
});
$(".portlet").addClass("ui-widget ui-widget-content ui-helper-clearfix ui-corner-all")
.find(".portlet-header")
.addClass("ui-widget-header ui-corner-all")
.prepend("<img style='float:right; margin-right: 17px;' class='ui-icon ui-icon-pencil portlet-edit'></img><span class='ui-icon ui-icon-minusthick portlet-toggle'></span>");
$(".portlet-edit").click(function () {
var icon = $(this);
alert("LOL");
});
$(".portlet-toggle").click(function () {
var icon = $(this);
icon.toggleClass("ui-icon-minusthick ui-icon-plusthick");
icon.closest(".portlet").find(".portlet-content").toggle();
});
}