简体   繁体   English

jQuery UI对话框..对话框内容在主页上加载

[英]Jquery UI dialog box.. dialog box content loading on main page

I am activating a dialog box like so: 我正在激活一个对话框,如下所示:

   $('a#addNew').click(function(){
   $('#popup').dialog({
       minWidth:  700,
       title:     'Select a product item'
   });
});

<div id="popup" style="color:#fff; background:#000; width:650px;">
    blah blah blah blah
</div>

thats all well and good.. but the dialog box (#popup) is actually showing up on my page until i click #addNew, in which case it disappears and transfers to the actual dialog box. 这一切都很好......但对话框(#popup)实际上显示在我的页面上,直到我点击#addNew,在这种情况下它会消失并转移到实际的对话框。 I only want the user to see that information when they click on #addNew. 我只希望用户在单击#addNew时看到该信息。 I dont want it to be sitting on the page. 我不希望它坐在页面上。 What am i doing wrong here? 我在这做错了什么?

<div id="popup" style="color:#fff; background:#000; width:650px; display:none;">
    blah blah blah blah
</div>

You need to hide this div while it is on the page. 您需要在页面上隐藏此div。 The dialog will then unhide it and display it for you. 然后,对话框将取消隐藏,并为您显示。

using css add 使用css add
display:none; 显示:无;

or using JQuery add 或使用JQuery添加
$('#popup').hide(); $( '#弹出')隐藏()。

It's on the main page because that's where you put it! 它在主页上, 因为那是你放的地方!

You need to hide the div (css - display: none ) when its first created. div(css- display: none )首次创建时需要隐藏。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM