图像onclick对话框?

时间:2013-05-22 12:45:46

标签: image onclick

我试图获取一个图像(cookie策略),一旦点击,它会显示一个对话框,通知该网站上使用了cookie。我希望使用jQuery对话框但似乎很难。

演示链接:http://myfirststepsto.weebly.com/

我想使用的jQuery:http://jqueryui.com/dialog/#default

<div id="oneout">
<span class="onetitle">

</span>
<div id="oneout_inner">
<centre>

<img src="https://dl.dropboxusercontent.com/u/89687987/mycookie.png"  alt="cookie policy" />
</a>

<br></center></div></div>

1 个答案:

答案 0 :(得分:3)

我为你做了一个小提琴,希望它有所帮助! jsFiddle here

HTML:

<div id="oneout">
    <span class="onetitle"></span>
    <div id="oneout_inner">
        <center>
            <a><img id="opener" src="https://dl.dropboxusercontent.com/u/89687987/mycookie.png"  alt="cookie policy" /></a>
            <br>
        </center>
    </div>
</div>
<div id="dialog" title="Basic dialog">
    <p>This is an animated dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>

<强>使用Javascript:

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