我正试图将旋转木马功能与我的Magento商店集成起来,但到目前为止却失败了。
我研究过owl旋转木马(http://owlgraphic.com/owlcarousel/),但无法将它与Magento集成。我认为这可能是因为owl旋转木马基于jquery,而Magento只支持原型-js,而不是jquery。我对noConflict程序不太确定。
将非常感激一步一步地集成猫头鹰旋转木马,或者可能是另一个原型JS旋转木马与Magento的集成。
提前谢谢。
发布于 2014-09-22 15:56:07
这个答案涉及到OPs希望使用猫头鹰旋转木马-它没有解决使用PrototypeJs的旋转木马的问题。
如果计划使用jQuery,则需要添加OwlCarousel。虽然我在原型旁边添加了第二个库,但我过去在Magento安装时也使用过猫头鹰传送带。
例如,在page.xml中(或者在需要加载jQuery的地方)--如果在default句柄下,这将在前端全局加载它。
<reference name="head">
...
<action method="addItem"><type>skin_js</type><name>js/vendor/jQuery/jQuery.1.11.min.js</name></action>
...
</reference>skin/frontend/[package]/[theme]/js/vendor/文件夹中。例如,关于page.xml -或适当的布局文档
<default>
<reference name="head">
<action method="addItem">
<type>skin_js</type>
<name>js/vendor/OwlCarousel/owl-carousel/owl.carousel.min.js</name>
</action>
<action method="addItem">
<type>skin_css</type>
<name>js/vendor/OwlCarousel/owl-carousel/owl.carousel.css</name>
</action>
<action method="addItem">
<type>skin_css</type>
<name>js/vendor/OwlCarousel/owl-carousel/owl.theme.css</name>
</action>
</reference>
</default>例如,如果要将其直接添加到加载旋转木马内容的.phtml文件中。显然,选择器仅用于演示。
<script>
(function ($) {
$(document).ready(function(){
var brandSlides = $("#hero-slides");
$(brandSlides).owlCarousel({
... OWL OPTIONS ...
});
});
}(jQuery));
</script>https://stackoverflow.com/questions/25976937
复制相似问题