【问题标题】:Jquery PrettyPhoto removing #prettyphoto from URLJquery PrettyPhoto 从 URL 中删除 #prettyphoto
【发布时间】:2012-11-05 05:03:01
【问题描述】:

我使用 3.1.4 版的 prettyphoto。 (http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/)。我想从 URL 中删除“#prettyphoto[iframe]/number/”。我设置了 deeplinking:false 但这无济于事。我知道这可能是这些功能的问题:

function getHashtag(){url=location.href;hashtag=(url.indexOf('#prettyPhoto')!==-1)?decodeURI(url.substring(url.indexOf('#prettyPhoto')+1,url.length)):false;return hashtag;};
function setHashtag(){if(typeof theRel=='undefined')return;location.hash=theRel+'/'+rel_index+'/';};
function clearHashtag(){if(location.href.indexOf('#prettyPhoto')!==-1)location.hash="prettyPhoto";}

有什么想法吗?

【问题讨论】:

  • +1。 #prettyphoto 附加到 URL 是#prettyAnnoying!

标签: javascript jquery wordpress plugins


【解决方案1】:

这是我的代码,它对我有用:

    <script type="text/javascript" charset="utf-8">
      $(document).ready(function(){
        $("a[rel^='prettyPhoto']").prettyPhoto({
        social_tools:false,
        deeplinking:false});
      });
    </script>

【讨论】:

    【解决方案2】:

    a) 这对我有用:

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

    这段代码在 jquery.prettyPhoto.js 的底部

    b) 还有一种方式,比如在jquery.prettyPhoto.js开头设置:deeplinking: false

    我的意思是:

    (function($){$.prettyPhoto={version:'3.1.4'};$.fn.prettyPhoto=function(pp_settings){pp_settings=jQuery.extend({.. deeplinking: false; ...}
    

    希望我能帮上忙。

    【讨论】:

    • 请给我更多细节,Manindra
    • 我已经完成了你上面提到的所有这些,但我无法从 url 中删除那个 #prettyphoto 标签。我也使用 3.1.4 版本。
    • 请使用 pastebin 或类似的工具并显示您的代码,我会尝试通过编辑来帮助您。
    【解决方案3】:

    3.1.5 版本可以使用

    (function($){$.prettyPhoto={version:'3.1.5'};
    $.fn.prettyPhoto=function(pp_settings){pp_settings=jQuery.extend(
    {.. deeplinking: false; ...}  
    

    【讨论】:

      【解决方案4】:

      这样的东西有用吗?

      (function($) {
          console.log('check');
      
          $.prettyPhoto = {
              version : '3.1.5'
          };
      
          $.fn.prettyPhoto = function(pp_settings) {
              pp_settings = $.extend({
                  deeplinking : false
              });
          };
      
          $("a[rel^='prettyPhoto']").prettyPhoto();
      
      })(jQuery);  
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-05-17
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多