【问题标题】:How to remove get parameters from prettyPhoto URL如何从 prettyPhoto URL 中删除获取参数
【发布时间】:2015-07-13 13:47:12
【问题描述】:

我想用 prettyPhoto 打开一个 iframe 并想优化 URL

<a href="iframe.html?iframe=true&width=100&height=100">

我尝试向链接添加一个类并通过 jQuery 传递参数,但这不起作用。

    $("a.iframe']").prettyPhoto({
        iframe: true, 
        width: '100%', 
        height: '100%'
    });

那么有没有办法摆脱 url 中的这些参数?

【问题讨论】:

    标签: jquery prettyphoto


    【解决方案1】:

    prettyPhoto 允许您像这样设置默认宽度/高度:

    $("a.iframe']").prettyPhoto({
      default_width: 100,
      default_height: 100
    });
    

    文档不允许任何其他选项来设置这些尺寸。 你可以阅读docs and see the full list of options here

    【讨论】:

      【解决方案2】:

      我对这个 prettyPhoto js 没有太多想法。但我认为你没有给锚链接提供类名,所以在你的代码中没有调用 jQuery 函数。请用下面的锚链接替换锚链接。

      <a href="iframe.html?iframe=true&width=100&height=100" class="iframe">
      

      谢谢, 阿米特·帕贾帕蒂

      【讨论】:

        猜你喜欢
        • 2012-11-05
        • 1970-01-01
        • 2013-05-17
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-07-19
        • 2014-09-08
        相关资源
        最近更新 更多