单击按钮时jQuery ui Dialog无法正常工作

时间:2022-12-01 14:20:37

I'm trying to modify a web page template which is based on bootstrap and jquery. I tried to add a dialog like in this page but it's not working. (It's the button that's not working on "Open Positions" section)

我正在尝试修改基于bootstrap和jquery的网页模板。我尝试在此页面中添加一个对话框,但它不起作用。 (这是不在“未平仓位”部分工作的按钮)

Below you can download my files. You can check index.html file.

您可以在下面下载我的文件。您可以检查index.html文件。

I add this javascript from the link

我从链接中添加了这个javascript

$(function() {
    $( "#dialog" ).dialog({
        autoOpen: false,
        show: {
            effect: "blind",
            duration: 1000
        },
        hide: {
            effect: "explode",
            duration: 1000
        }
    });

    $( "#opener" ).click(function() {
        $( "#dialog" ).dialog( "open" );
    });
});

And added following lines for that javascript:

并为该javascript添加了以下行:

<div id="dialog" title="Contact Us">
    <p>info@info.info</p>
</div>
<button id="opener">Open Dialog</button>

Why it's not working?

为什么它不起作用?

Another question; instead of using this jquery ui component, how can i jump to content to "Contact Us" section from "Open Positions" section? This also i wonder because they both in same html file.

另一个问题;而不是使用这个jquery ui组件,如何从“打开位置”部分跳转到“联系我们”部分的内容?这也是我想知道,因为他们都在相同的HTML文件中。

1 个解决方案

#1


1  

Did you try show?

你试过秀吗?

$( "#opener" ).click(function() {
    $( "#dialog" ).dialog( "show" );
});

Got the error in your file: It is incorrect reference to the CSS:

在您的文件中出现错误:它是对CSS的错误引用:

<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.11.0/jquery-ui.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.11.0/themes/smoothness/jquery-ui.css">
<link rel="stylesheet" href="http://jqueryui.com/resources/demos/style.css">

There's an extra reference to jQuery twice that caused the issue. Please remove the other version of jQuery and move all the scripts to the bottom.

有两次jQuery的额外引用导致了这个问题。请删除其他版本的jQuery并将所有脚本移到底部。

#1


1  

Did you try show?

你试过秀吗?

$( "#opener" ).click(function() {
    $( "#dialog" ).dialog( "show" );
});

Got the error in your file: It is incorrect reference to the CSS:

在您的文件中出现错误:它是对CSS的错误引用:

<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.11.0/jquery-ui.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.11.0/themes/smoothness/jquery-ui.css">
<link rel="stylesheet" href="http://jqueryui.com/resources/demos/style.css">

There's an extra reference to jQuery twice that caused the issue. Please remove the other version of jQuery and move all the scripts to the bottom.

有两次jQuery的额外引用导致了这个问题。请删除其他版本的jQuery并将所有脚本移到底部。