如何从网址中删除#prettyphoto

Man*_*ngh 13 javascript tags jquery wordpress-plugin prettyphoto

即时通讯使用prettyphoto媒体wordpress插件(版本3.1.4).它的工作正常,但我的问题是,当我点击任何图像并在灯箱中打开然后在网址中有一些额外的标签,如:#prettyPhoto [landscaping]/0 /这就是为什么网址看起来像:www.myssite.com/#prettyPhoto[landscaping]/0/.

我们如何删除这个额外的标签.这是我的jquery.prettyPhoto.js文件中的代码:

function setHashtag(){
        if(typeof theRel == 'undefined') return; // theRel is set on normal calls, it's impossible to deeplink using the API
        location.hash = theRel + '/'+rel_index+'/';
    };

    function clearHashtag(){
        if ( location.href.indexOf('#prettyPhoto') !== -1 ) location.hash = "prettyPhoto";
    }
Run Code Online (Sandbox Code Playgroud)

小智 45

昨天我遇到了同样的问题,我很确定我在stackoverflow中找到了答案......我访问了很多网站,论坛......所以我不记得我在哪里得到了答案.

无论如何,我正在使用Dreamweaver,但我想WP中的代码类似.

你要做的是在调用prettyPhoto时将deeplinking属性指定为false.

这是我的代码:

    $(document).ready(function(){
        $("a[rel^='prettyPhoto']").prettyPhoto({
            theme:'light_rounded',
            social_tools:false,
            deeplinking:false,      
    });
});
Run Code Online (Sandbox Code Playgroud)

我是js的总菜鸟,但我希望这有帮助:)