我正在尝试将flipcounter添加到我的magento网站(http://bit.ly/1hzfQMA)的主页上http://bloggingsquared.com/jquery/flipcounter/
添加以下脚本后,页脚中的新闻稿按钮将无效。
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript"></script>
<script src="js/jquery.easing.1.3.js" type="text/javascript"></script>
<script src="js/jquery.flipCounter.1.2.pack.js" type="text/javascript"></script>
我尝试在jquery.flipCounter.1.2.pack.js中使用以下内容添加,但仍无法正常工作
(function($) {
$(function() {
// more code using $ as alias to jQuery
});
})(jQuery);
// other code using $ as an alias to the other library
我注意到magento已经有了jquery 1.8.2,我还需要添加jquery1.6.2吗?
答案 0 :(得分:0)
尝试在准备好的函数中添加这个jQuery,它在控制台中给出错误我希望它能解决你的问题。
$('.vid_trigger').click( function(e){
e.preventDefault();
$( "#showSlideshowVideo" ).remove();
var URL = $(this).attr('videoLink');
var htm = '<iframe width="640" height="360" style="width:640px;height:360px;" src="http://www.youtube.com/embed/' + URL + '?autoplay=1" frameborder="0" allowfullscreen ></iframe>';
$('#lightVideoBox').append(htm);
return false;
});
答案 1 :(得分:0)
您需要使用jQuery.noConflict()开始脚本;并将'$'更改为'jQuery',否则脚本将无法与原生Prototype框架很好地配合使用。
jQuery.noConflict();
(function(jQuery) {
jQuery(function() {
// ... No $s
});
})(jQuery);
// ... No $s
对于jQuery库,我认为Magento只在特定页面上调用特定功能 - 如图像缩放(如果启用)。因此,您需要将jQuery库调用到您的主页。最佳做法是将以下内容添加到local.xml ...
<cms_index_index><!-- Handle pinpoints the home page -->
<reference name="head"><!-- Identifies the head block -->
<action method="addItem">
<type>skin_js</type>
<name>js/jquery.min.js</name><!-- specify your library location and file name within skin/js -->
</action>
</reference>
</cms_index_index>
您始终可以通过输入相同的XML来使用CMS页面管理中的页面布局更新,但不要使用布局句柄。