[英].addClass() not working in JQuery function
I have numerous websites that are on a "dev" site meaning that it is dummy data and not all functionality works. 我在“开发”站点上有许多网站,这意味着它是虚拟数据,并非所有功能都可以正常工作。 What happens is that I have this function in my document.ready() that is supposed to find the html for the popup box and add a class to it, which gives the popup box a little blue header bar.
发生的是我在document.ready()中具有此功能,该功能应该为弹出框找到html并向其中添加一个类,这为弹出框提供了一个蓝色的小标题栏。 Function:
功能:
$("document").ready(
function(){
//loadSummary();
NOT_AVAILABLE_ALERT = $("#modalMessageAlert").dialog(
{
position: "center",
resizable: false,
bgiframe: true,
autoOpen: false,
width: 250,
height: 200,
draggable: false,
modal: true,
close:function(event,ui){
},
open:function(event,ui){
}
});
modifyModalHeader("modalMessageAlert","demo_dialog_header");
}
);
function modifyModalHeader(id,className){
var refs = $("#"+id).prev();
var ref = refs.eq(0);
ref.addClass(className);
}
function navigateDemo() {
NOT_AVAILABLE_ALERT.dialog("open");
}
HTML 的HTML
<div id="tempXML" ></div>
<div id="modalMessageAlert"style="left:-200px; display:none">
<h3>This feature is not available in this demo household.</h3>
<input style="margin-bottom: 15px" type="button" Value="Close" onclick="NOT_AVAILABLE_ALERT.dialog('close');"/>
</div>
HTML link: HTML链接:
<input type="submit" onclick="javascript:navigateDemo();return false;" value="Save" id="save"/>
CSS 的CSS
#modalMessageAlert {
background-color:#fff;
cursor:pointer;
padding: 10px 10px 10px 10px;
text-align:center;
vertical-align:middle;
}
.demo_dialog_header {
background-image:url(/backoffice/Prospects/APP360/images/demo_modal_header.gif)
}
If i understand correctly the modifyModalHeader function is supposed to find the tempXML div using the .prev() functionality and add that class to the tempXML div, and then when a user clicks the "submit" aka save button it shows the dialog, the dialog shows fine, just without the referenced image as the background-image, which just creates a solid blue line across the top about 15px wide. 如果我正确理解,则ModifyModalHeader函数应该使用.prev()功能查找tempXML div并将该类添加到tempXML div中,然后当用户单击“提交”又称为“保存”按钮时,它将显示对话框,对话框可以正常显示,只是没有将引用的图像作为背景图像,而是仅在顶部宽约15像素处创建了一条实线。 This EXACT same functionality and references work on pages included in the same directories just fine, but for some reason i can't get this to load correctly.
这种完全相同的功能和引用可以在相同目录中包含的页面上正常工作,但是由于某些原因,我无法正确加载此页面。 Any help is greatly appreciated.
任何帮助是极大的赞赏。 -NickG
-尼克
原来,我有冲突的样式表覆盖了该类,因为我使用了一些JQuery日历扩展程序,并且如同该弹出窗口一样被引用为ui-widgets。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.