简体   繁体   English

锚标签在fancybox中不起作用

[英]Anchor tag is not working in fancybox

I want to logout (redirect to the logout page) when I click on "LOGOUT" . 当我单击“ LOGOUT”时,我想注销(重定向到注销页面)。

<div id="emailverification" style="display:none;">
<div style="width: 100%;float:left;background-color: #E4E5EA;">

$(document).ready(function () {
    $("#emailverification").fancybox({
        closeClick: false, // prevents closing when clicking INSIDE fancybox 
        openEffect: 'none',
        closeEffect: 'none',
        closeBtn: false,
        keys: {
            close: null
        },
        helpers: {
            overlay: {
                closeClick: false
            }
            // prevents closing when clicking OUTSIDE fancybox 
        }
    }).trigger("click");
});

Check the html code in JSFIDDLE . 检查JSFIDDLE中的html代码。

Try this code: 试试这个代码:

$(document).ready(function() {
            $("#emailverification").fancybox({
             closeClick  : false, // prevents closing when clicking INSIDE fancybox 
             openEffect  : 'none',
             closeEffect : 'none',             
             closeBtn : false,             
//             keys : {
//                close  : null
//             },
             helpers   : { 
              overlay : {closeClick: false} // prevents closing when clicking OUTSIDE fancybox 
             }
            }).trigger("click");
    $('#logout').click(function(){
        window.location="http://www.example.com/";
    })
        });

Add this after your script. 在脚本之后添加它。 As stated in the comments fancybox is blocking any element from being clicked inside the pop-up. 如评论所述, fancybox禁止在弹出窗口中单击任何元素。 An alternative is to redirect yourself using this script. 一种替代方法是使用此脚本重定向自己。

$('#emailverification a[href=logout]').click(function (e) {
    location.href = this.href;
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM