gpt4 book ai didi

javascript - 如何从网址中删除#prettyphoto

转载 作者:可可西里 更新时间:2023-11-01 01:45:17 26 4
gpt4 key购买 nike

我正在使用 prettyphoto media wordpress 插件(版本 3.1.4)。它对我来说工作正常,但我的问题是当我点击任何图像并在灯箱中打开时,url 中有一些额外的标签,如:#prettyPhoto[landscaping]/0/这就是为什么 url 看起来像:www .myssite.com/#prettyPhoto[美化环境]/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";
}

最佳答案

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

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

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

这是我的代码:

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

我完全是 js 菜鸟,但我希望这对您有所帮助:)

关于javascript - 如何从网址中删除#prettyphoto,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16692439/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com