我创建了一个模态窗口,在我的网站中加载任何页面时显示。我正在使用这个模态窗口进行语言选择。我希望用户能够通过单击隐藏此窗口按钮来隐藏(1个月)语言选择模式窗口。
我有一个模态窗口打开并将内容加载到外部文件中:
jQuery(document).ready(function(){
//name, value, additional -- expire cookie in 30 days
jQuery.colorbox({href:'/language.php', iframe:true, open:true, width:860, height:450})
});
这是带有语言选择菜单的外部文件:
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<title></title>
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="robots" content="" />
<style>
#lang-container {width: 100%}
.halfregion {display: block; float: left; width: 50%;}
.langblock {float: left; width: 40%; background: #ebebf1; margin: .5em; padding: 0.5em; height: 230px; text-align: center;}
</style>
</head>
<body>
<div id="lang-container">
<div class="halfregion">
<h2>Choose your region</h2>
<div class="langblock">
<p style="text-align: center"><img src="/sites/all/themes/podsystem/images/en-us.png" width=80 alt="US region" /></p>
<p>This site includes content and products for US, please select this region if you are in United States.</p>
<p><a href="/en-us">US English</a></p>
</div>
<div class="langblock">
<p style="text-align: center"><img src="/sites/all/themes/podsystem/images/en.png" width=80 alt="International English region" /></p>
<p>Select this region if you are outside US.</p>
<p><a href="/">English</a></p>
</div>
<p><a class="hidthis" href="#">Click here to stop showing this message</a></p>
</div>
<div class="halfregion">
<h2>Elige tu región</h2>
<div class="langblock">
<p style="text-align: center"><img src="/sites/all/themes/podsystem/images/es.png" width=80 alt="US region" /></p>
<p>Selecciona esta region si hablas español.</p>
<p><a href="/es">Español</a></p>
</div>
<div class="langblock">
<p>We are working to improve your experience using our sites. Would you like to see other languages? Drop us a comment.</p>
<p><a href="/contact-us/contact-form">Contact us</a></p>
</div>
<p><a class="hidthis" href="#">Pincha aquí para dejar de mostrar este mensaje.</a></p>
</div>
</div>
</body>
</html>
我现在真的被困住了,当用户点击.hidthis类的链接时,如何让模态窗口关闭?
提前致谢。
答案 0 :(得分:0)
http://www.jacklmoore.com/colorbox/处的文档建议您可以将$.colorbox.close()
附加到指向&#34;发起关闭序列的链接。&#34;
如果您不再使用该插件的功能,$.colorbox.remove()
也可用于禁用该功能,并规定您在页面生命周期内不再需要它