【问题标题】:How do I debug a custom Colorbox installation for Magento如何调试 Magento 的自定义 Colorbox 安装
【发布时间】:2011-10-11 13:18:22
【问题描述】:

我想要一个 Colorbox (http://jacklmoore.com/colorbox/) 灯箱,可以在静态页面的迷你画廊中显示产品图片。

我在 Magento 上安装了 colorbox:

JS

  • /skin/frontend/{custom}/default/js/colorbox.inline.js
  • (用于示例头部的内联脚本)

  • /skin/frontend/{custom}/default/js/jquery.colorbox.js

CSS - /skin/frontend/{custom}/default/css/colorbox.css

图片 - /skin/frontend/{custom}/default/images/...


我在“自定义布局更新 XML”下更新了后端页面的 XML,如下所示:

skin_csscss/colorbox.css skin_jsjs/jquery/jquery.1.6.min.js skin_jsjs/jquery/jquery.colorbox.js skin_jsjs/jquery/colorbox.inline.js

当我单击颜色框类链接进行测试时,图像在同一选项卡中打开,但作为外部文件。我设置了一个引用相同图像的本地文件,并引用了我用于 Magento 的 JS 和 CSS 文件,并且灯箱工作。

我对正在发生的事情有点困惑,因此欢迎任何提示、想法和建议。

干杯!

【问题讨论】:

    标签: jquery magento lightbox colorbox


    【解决方案1】:

    这就是你需要的。 将您的 javascript 文件移动到 /js/colorbox/jquery.colorbox.js /js/colorbox/colorbox.inline.js

    <reference name="head">
        <action method="addJs"><script>colorbox/jquery.colorbox.js</script></action>
        <action method="addJs"><script>colorbox/colorbox.inline.js</script></action>
    </reference >
    

    这将使您加载 javascript 文件。查看 page.xml 文件以了解如何从皮肤文件夹加载 css 文件。

    【讨论】:

    • 感谢您的提示。不幸的是,它仍然无法正常工作。我移动了 JS 文件并包含了您拥有并添加的代码:&lt;action method="addCss"&gt;&lt;stylesheet&gt;css/colorbox.css&lt;/stylesheet&gt;&lt;/action&gt; 到 /app/design/frontend/{custom}/default/layout/page.xml。在代码中,我看到 colorbox js refs 出现在实际的 jquery ref 上方,这是一个问题吗?
    • 是的,jquery include 必须是第一个。
    猜你喜欢
    • 2012-03-18
    • 1970-01-01
    • 2010-09-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-01
    • 1970-01-01
    相关资源
    最近更新 更多