admin管理员组文章数量:1404464
For some reason I cannot get Fancybox to close using the close button they supplied. I have managed to get it to close using an tag however a popup window appears from nowhere when its clicked?
Here is a link to the page in question:
.php
Here is what I am calling:
<script type="text/javascript" src="//ajax.googleapis/ajax/libs/jquery/1.9.1/jquery.js"></script>
<link href="assets/css/jquery.fancybox.css?v=2.1.5" rel="stylesheet">
<script src="assets/js/jquery.fancybox.pack.js?v=2.1.5"></script>
<script type="text/javascript">
$(document).ready(function($){
$.fancybox.open([{
content: $(".popup")
}]);
});
</script>
The close button I added is on the RHS at the bottom (called close).
<a href="javascript:void(0);" onclick="$.fancybox.close();">Close</a>
Any help would be much appreciated :)
Cheers
For some reason I cannot get Fancybox to close using the close button they supplied. I have managed to get it to close using an tag however a popup window appears from nowhere when its clicked?
Here is a link to the page in question:
http://events.usefulsocialmedia./customerservice/brochure2-thank-you.php
Here is what I am calling:
<script type="text/javascript" src="//ajax.googleapis./ajax/libs/jquery/1.9.1/jquery.js"></script>
<link href="assets/css/jquery.fancybox.css?v=2.1.5" rel="stylesheet">
<script src="assets/js/jquery.fancybox.pack.js?v=2.1.5"></script>
<script type="text/javascript">
$(document).ready(function($){
$.fancybox.open([{
content: $(".popup")
}]);
});
</script>
The close button I added is on the RHS at the bottom (called close).
<a href="javascript:void(0);" onclick="$.fancybox.close();">Close</a>
Any help would be much appreciated :)
Cheers
Share Improve this question asked Sep 24, 2013 at 9:18 user1847224user1847224 1- What error you are getting? – Murali Murugesan Commented Sep 24, 2013 at 9:21
2 Answers
Reset to default 4To close the fancybox you can add class attribute to your link as below:
<a href="#" class="closeLink">Close</a>
JS CODE:
$(document).ready(function(){
$('.closeLink').on('click', function(event){
event.stopPropagation();
$.fancybox.close();
});
});
Just try like this
<a href="javascript:$.fancybox.close();" >Close</a>
Hope it helps you.
本文标签: javascriptFancybox Close Not workingStack Overflow
版权声明:本文标题:javascript - Fancybox Close Not working - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744802606a2625953.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论