Javascript 关闭和打开jquery弹出窗口添加多个按钮
使用Jquery弹出窗口iv在标题栏上的“X”按钮旁边添加了一个帮助图标。问题是当我关闭弹出窗口并再次打开它时,有2个帮助图标,关闭和打开,有3个…等等 我可以将“显示”设置为“无”,这会将其删除,但下次打开弹出窗口时,会出现两个手动图标…尝试:Javascript 关闭和打开jquery弹出窗口添加多个按钮,javascript,jquery,html,css,asp.net,Javascript,Jquery,Html,Css,Asp.net,使用Jquery弹出窗口iv在标题栏上的“X”按钮旁边添加了一个帮助图标。问题是当我关闭弹出窗口并再次打开它时,有2个帮助图标,关闭和打开,有3个…等等 我可以将“显示”设置为“无”,这会将其删除,但下次打开弹出窗口时,会出现两个手动图标…尝试: <script> $('#helpIconBtn').removeClass(".ui-dialog-titlebar"); $('.helpIconBtn').removeClass(".ui-dialog-tit
<script>
$('#helpIconBtn').removeClass(".ui-dialog-titlebar");
$('.helpIconBtn').removeClass(".ui-dialog-titlebar");
$('#iconhelp').removeClass(".ui-dialog-titlebar");
$('#iconhelp').removeClass(".helpIconBtn");
// $('#iconhelp').css('display', 'none');
//$(".iconhelp").removeClass
// $(".iconhelp").classList.remove(".ui-dialog-titlebar");
$("iconhelp").removeClass("helpIconBtn");
$("iconhelp").removeClass(".ui-dialog-titlebar");
</script>
$('helpIconBtn').removeClass(“.ui对话框标题栏”);
$('.helpIconBtn').removeClass(“.ui对话框标题栏”);
$('#iconhelp').removeClass(“.ui对话框标题栏”);
$('#iconhelp').removeClass(“.helpIconBtn”);
//$('iconhelp').css('display','none');
//$(“.iconhelp”).removeClass
//$(“.iconhelp”).classList.remove(“.ui对话框标题栏”);
$(“iconhelp”).removeClass(“helpIconBtn”);
$(“iconhelp”).removeClass(“.ui对话框标题栏”);
代码:
var floater_style_feature_panel_popup = $("#floater_Style_Features_Panel_popup");
floater_style_feature_panel_popup.dialog({
resizable: false
},
{ width: "auto" },
{ height: "auto" },
{ position: { my: "top+45", at: "bottom", of: $("header")} },
{ show: { effect: "slideDown"} },
{dialogClass: "helpIconBtn"},
{ hide: true },
{ open: function (event, ui) {
floater_style_feature_panel_popup[0].parentNode.classList.add("opaqueDialog");
ResizeStylerDialog();
}
},
{ beforeClose: function (event, ui) {
if (closeFeatureStyler == false) {
var funcParamCall = { "funcParam": [{ "funcName": "OnFeatureStylePreClose()"}] };
$$("FeatureStyler")[0].contentWindow.postMessage(JSON.stringify(funcParamCall), "*");
alert("false");
return false;
}
else {
alert("true");
//$('#iconhelp').removeClass(".ui-dialog-titlebar");
//$('#helpIconBtn').removeClass(".ui-dialog-titlebar");
//$('.helpIconBtn').removeClass(".ui-dialog-titlebar");
// $('#iconhelp').removeClass(".helpIconBtn");
// $('#iconhelp').css('display', 'none');
// $('#iconhelp').css('display', 'none');
// $(".iconhelp").classList.remove(".ui-dialog-titlebar");
//$("iconhelp").removeClass("helpIconBtn");
//$("iconhelp").removeClass(".ui-dialog-titlebar");
return true;
}
}
},
{ closeOnEscape: true
}).parent().appendTo("form:first");
$(".helpIconBtn").children(".ui-dialog-titlebar").append("<span id='iconhelp' class='ui-icon ui-icon-help'></span>");
$("#iconhelp").click(function () {
alert('help');
});
#iconhelp{
cursor: pointer;
float: right;
margin-right:15px;
margin-top: 1px;
background-color: #EEEEEE;
width: 18px;
height: 20px;
border-radius:4px;
}
var浮点型特征面板弹出=$(“#浮点型特征面板弹出”);
浮动框\样式\功能\面板\弹出对话框({
可调整大小:false
},
{宽度:“自动”},
{高度:“自动”},
{位置:{my:“top+45”,在:$(“header”)}的“bottom”处,
{show:{效果:“slideDown”},
{dialogClass:“helpIconBtn”},
{hide:true},
{打开:函数(事件,用户界面){
浮动框\样式\功能\面板\弹出窗口[0]。父节点。类列表。添加(“不透明对话框”);
ResizeStylerDialog();
}
},
{beforeClose:函数(事件,ui){
if(closeFeatureStyler==false){
var funcParamCall={“funcParam”:[{“funcName”:“OnFeatureStylePreClose()”}]};
$$(“FeatureStyler”)[0].contentWindow.postMessage(JSON.stringify(funcParamCall),“*”;
警告(“假”);
返回false;
}
否则{
警惕(“真实”);
//$('#iconhelp').removeClass(“.ui对话框标题栏”);
//$('helpIconBtn').removeClass(“.ui对话框标题栏”);
//$('.helpIconBtn').removeClass(“.ui对话框标题栏”);
//$('#iconhelp').removeClass(“.helpIconBtn”);
//$('iconhelp').css('display','none');
//$('iconhelp').css('display','none');
//$(“.iconhelp”).classList.remove(“.ui对话框标题栏”);
//$(“iconhelp”).removeClass(“helpIconBtn”);
//$(“iconhelp”).removeClass(“.ui对话框标题栏”);
返回true;
}
}
},
{closeOnEscape:对
}).parent().appendTo(“格式:first”);
$(“.helpIconBtn”).children(“.ui对话框标题栏”).append(”);
$(“#iconhelp”)。单击(函数(){
警惕(“帮助”);
});
#伊肯赫尔普{
光标:指针;
浮动:对;
右边距:15px;
页边顶部:1px;
背景色:#EEEEEE;
宽度:18px;
高度:20px;
边界半径:4px;
}
最可能的情况是,每次用户打开弹出窗口时,您都会添加图标,而在弹出窗口关闭时,您只是删除了图标的类别。
只需检查您是否有多个id为“iconhelp”的跨度
如果是这样,您可以通过两种不同的方式进行修复:
$("#iconhelp").click(function () {
alert('help');
});
致:
最有可能的是,每次用户打开弹出窗口时,您都会添加图标,而在弹出窗口关闭时,您只是删除了图标的类别。 只需检查您是否有多个id为“iconhelp”的跨度 如果是这样,您可以通过两种不同的方式进行修复:
$("#iconhelp").click(function () {
alert('help');
});
致:
我看到您在每个调用中添加了一个id为iconhelp的span,如果需要,请在调用中添加此span,然后在弹出窗口关闭时删除此span,为此,使用事件beforeClose并放入$('#iconhelp')。remove()此选项删除您在每个调用中创建的整个元素
{ beforeClose: function (event, ui) {
if (closeFeatureStyler == false) {
var funcParamCall = { "funcParam": [{ "funcName": "OnFeatureStylePreClose()"}] };
$$("FeatureStyler")[0].contentWindow.postMessage(JSON.stringify(funcParamCall), "*");
alert("false");
return false;
}
else {
alert("true");
//$('#iconhelp').removeClass(".ui-dialog-titlebar");
//$('#helpIconBtn').removeClass(".ui-dialog-titlebar");
//$('.helpIconBtn').removeClass(".ui-dialog-titlebar");
// $('#iconhelp').removeClass(".helpIconBtn");
// $('#iconhelp').css('display', 'none');
// $('#iconhelp').css('display', 'none');
// $(".iconhelp").classList.remove(".ui-dialog-titlebar");
//$("iconhelp").removeClass("helpIconBtn");
//$("iconhelp").removeClass(".ui-dialog-titlebar");
$("#iconhelp").remove();
return true;
}
}
我看到您在每个调用中添加了一个id为iconhelp的span,如果需要,请在调用中添加此span,然后在弹出窗口关闭时删除此span,为此,使用事件beforeClose并放入$('#iconhelp')。remove()此选项删除您在每个调用中创建的整个元素
{ beforeClose: function (event, ui) {
if (closeFeatureStyler == false) {
var funcParamCall = { "funcParam": [{ "funcName": "OnFeatureStylePreClose()"}] };
$$("FeatureStyler")[0].contentWindow.postMessage(JSON.stringify(funcParamCall), "*");
alert("false");
return false;
}
else {
alert("true");
//$('#iconhelp').removeClass(".ui-dialog-titlebar");
//$('#helpIconBtn').removeClass(".ui-dialog-titlebar");
//$('.helpIconBtn').removeClass(".ui-dialog-titlebar");
// $('#iconhelp').removeClass(".helpIconBtn");
// $('#iconhelp').css('display', 'none');
// $('#iconhelp').css('display', 'none');
// $(".iconhelp").classList.remove(".ui-dialog-titlebar");
//$("iconhelp").removeClass("helpIconBtn");
//$("iconhelp").removeClass(".ui-dialog-titlebar");
$("#iconhelp").remove();
return true;
}
}
我看到您使用的是<代码> HelpPoNbTn和