我創(chuàng)建了一個contextmenu來顯示特定類,但是當我克隆具有該類的元素時,不會contextmenu顯示。顯示上下文菜單:// Trigger action when the contexmenu is about to be shown$(".ui-editable").bind("contextmenu", function (event) { // Avoid the real one event.preventDefault(); //Save the selected and the parent element selected_area = $(this); parent_area = $(this).parent(); $(this).addClass('selected-menu')// Show contextmenu $("#editContextMenu").finish().toggle(100). // In the right position (the mouse) css({ top: event.pageY + "px", left: event.pageX + "px" });});克隆元素:function cloneBlock() { $(selected_area).clone().appendTo(parent_area);}完整的示例在這里: https ://jsfiddle.net/marana12/xsd2n9uo/9/
在克隆元素中顯示上下文菜單
達令說
2023-10-14 16:16:34