开发者

Close modal and load new url?

I am using ColorBox to launch a modal window on my site. I开发者_运维知识库n the modal a SurveyMonkey survey loads. At the end of the survey, depending on how people answer it, they will be offered a link to click. When clicked, we need to CLOSE the modal and then load a new page in the main site under the modal. Is there a way to do that by clicking a link in the modal?

THANKS for your help and expertise.


// put it in the base document
    $(document).bind('cbox_closed', function(){
            // navigate to new URI in a prefered way
    });


// a little different way to achieve same result
$(".example9").colorbox(
{
    onClosed:function()
    {
        // navigate to new URI in a prefered way
    }
});

Additional example.

HTML:

<a id="base" href="#">Show colorbox</a>
<div style='display: none'>
        <div id='divModal' style='padding: 10px; background: #fff; border: 1px solid red; z-index=100;'>This is test
            <a id="google" href="#">google.com</a>
        </div>
    </div>

JavaScript:

$('a#base').colorbox({inline: false, href:'#divModal', width: "150px", height: "100px"});

$('a#google').click(
    function()
    {
        $.colorbox.close();
        window.location = 'google.com';
    }
)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜