我是 Magento 的新手,我想将自定义 CCS 和 jQuery 添加到主页正文中,我该怎么做,请有人逐步解释该过程或可以为我提供链接吗?
最佳答案
您需要创建 local.xml
在您当前的主题布局文件夹中并添加以下代码以仅在主页上添加自定义 Js 和 css:
<?xml version="1.0"?>
<layout version="0.1.0">
<cms_index_index>
<reference name="head">
<action method="addJs"><script>custom.js</script></action> // JS file must be place in Root JS folder
<action method="addCss"><stylesheet>css/custom.css</stylesheet></action> // CSS file must be in current theme folder
</reference>
</cms_index_index>
</layout>
如果您想在所有页面上添加此 CSS 和 JS,您需要将处理程序从 <cms_index_index>
更改为至 <default>
关于jquery - 将 javascript 和 css 添加到 Magento,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31182527/