【问题标题】:Adding attributes to img tag in Colorbox in WP在 WP 的 Colorbox 中向 im​​g 标签添加属性
【发布时间】:2012-01-22 21:19:59
【问题描述】:

我想为我的 Colorbox 中的每个 img 标签添加一个附加属性 - 特别是我想添加:draggable="false"。

我已经获得了正确的 JQuery UI 脚本,并且正在通过在我的 NextGen Gallery 安装中添加属性来在图库中使用它。如果我可以在 Colorbox 中将属性添加到 img 标签中,那就太好了。

colorbox 的输出如下所示: img class="cboxPhoto" width="321" height="480" src="/wp-content/gallery/macros/02574_small.png" style="cursor: pointer;浮动:无;”。如果我直接在标签中添加属性(使用 Firebug),它就可以工作;我只是不知道在哪里添加 js。 (从任何标准来看,我都不是 Javascript 或 JQuery 专家。)

任何建议将不胜感激。

- Colorbox: 1.3.19
- jQuery UI: 1.8.17
- jQuery: 1.7.1
- NExtGEN Gallery: 1.9.2
- Lightbox Plus: 2.4.6
- WP: 3.3.1

【问题讨论】:

    标签: image draggable colorbox


    【解决方案1】:

    尝试将此脚本添加到您的文档中:

    <script>
    jQuery(document).bind('cbox_complete', function(){
        jQuery('.cboxPhoto').attr('draggable', 'false');
    });
    </script>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-11-29
      • 2011-03-08
      • 2017-09-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多