如何应用自定义 CSS 和 Javascript 特定的 CMS 页面 Magento

How to apply custom CSS and Javascript specific CMS page Magento

我想添加 lightbox 以便在我的一个特定 CMS 页面上播放视频。我将 CSS 文件放在 JS/MY THEME/JQUERY/PLUGIN/VENOBOX/CSS/myfile.css 中,将 JS 文件放在 JS/MY THEME/jquery/plugins/venobox/js/myfile.js 中,但它不起作用。我什么都做,但不工作。

我在 CMS 页面的布局更新 XML 中使用了以下代码:

<reference name="head">
    <action method="addItem">
        <type>js_css</type>
        <name>smartwave/jquery/plugins/venobox/css/html5boxplayer.css</name>
    </action>
    <action method="addJs">
        <script>
            smartwave/jquery/plugins/venobox/js/html5lightbox.js
        </script>
    </action>
    <action method="addJs">
        <script>
            smartwave/jquery/plugins/venobox/js/jquery.js
        </script>
    </action>
</reference>

如果有人实现了此功能,请提供帮助。提前致谢。

对于 css,您需要将文件包含在 xml 文件中,如下所示:

<action method="addItem">
   <type>skin_css</type>
   <name>css/html5boxplayer.css</name>
</action>

对于js需要做同样的操作如下:

<action method="addItem">
   <type>skin_js</type>
   <name>js/html5lightbox.js</name>
</action>

注意类型声明。当然,所有文件都应该放在主题下的特定文件夹中。