3

我将此代码与fancybox 1.3.7 一起使用。当 fancybox 打开 url 更改为相应的 div (/page#div-id) 时,当它关闭时它应该返回到 /page 但注释功能不起作用。我必须使用一个临时值,如下所示。我怎样才能解决这个问题?

window.onload = function(){
    function showfb(id) {
        if (/^#.*/.test(id)) {
            $(id).show();
            $.fancybox({
                href: id,
                type:'inline',
                position: 'center',
                'transitionIn': 'fade', // elastic, none, ease, fade
                'transitionOut': 'fade',
                onClosed: function(){
                    //$(id).hide();
                    window.location.hash = "_"; // temporary
                }
            });
        }
    }
    showfb(location.hash);
    $('a.profile').click(function(e){
            showfb($(this).attr('href'));
    });
};
4

1 回答 1

2

Try replacing the function with the below:

window.location.hash = "";
于 2013-04-17T03:29:27.610 回答