我正在使用ColorBox在我的网站上启动模态窗口。在模态中,SurveyMonkey调查会加载。在调查结束时,根据人们的回答方式,他们将获得点击链接。单击时,我们需要关闭模态,然后在模式下的主站点中加载新页面。有没有办法通过点击模态中的链接来做到这一点?
感谢您的帮助和专业知识。
答案 0 :(得分:0)
// 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
}
});
附加示例。
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';
}
)