shmnsw
shmnsw

Reputation: 649

open js popup by clicking a button

i have index html page in my site, its the main page. in the index html i have a button and by clicking it i want to open a popup form, i have the js file and css file of this popup included in the index html.

i just cant open this animated popup by clicking the input type button.. can anyone help me?

the clouds js:

        $(function ()
{
    // Register Smart skin.
    $.speedoPopup.registerSmartSkin('clouds', function (overlay, container)
    {
        // We don't want to brake anything if there is no overlay.
        if (!overlay)
        {
            return ;
        }

        if ($.speedoPopup.browser_ie && $.speedoPopup.browser_ie< 9)
        {
            return;
        }

        var clouds = '<div class="cloud x1"></div><div class="cloud x2"></div><div class="cloud x3"></div><div class="cloud x4"></div><div class="cloud x5"></div>';

        overlay.append(clouds);
    });
});

index html: below the head tag

<link type='text/css' href='clouds/clouds.css' rel='stylesheet' media='screen' />
<script type='text/javascript' src='clouds/clouds.js'></script>

and the button:

<div>
<input type='button' name='clouds' value='Clouds'/>
</div>

Upvotes: 1

Views: 33182

Answers (1)

U.P
U.P

Reputation: 7442

You have to invoke the dialog on click

Lets give you button an id

<div>
<input id="btnDialog" type='button' name='clouds' value='Clouds'/>
</div>

Now create a div that you want to show in dialog

<div  id="divContentToPopup">
   ...content here...
</div>

now you have to hook a click event on it

$('#btnDialog').click(function ()
{
    $(this).speedoPopup(
    {
        width:550,
        height:265,
        useFrame: TRUE,
        href: '#divContentToPopup'
    });
});

Upvotes: 1

Related Questions