【发布时间】:2013-12-03 04:55:05
【问题描述】:
我在 C:\wamp\www\magento\app\design\frontend\base\default\template\catalog\product\view.phtml 中使用 Tab 选项,与以下 Jquery 一起使用,
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script>
$(document).ready(function() {
$('ul.tabs').each(function(){
var active, content, links = $(this).find('a');
active = links.first().addClass('active');
content = $(active.attr('href'));
links.not(':first').each(function () {
$($(this).attr('href')).hide();
});
$(this).find('a').click(function(e){
active.removeClass('active');
content.hide();
active = $(this);
content = $($(this).attr('href'));
active.addClass('active');
content.show();
return false;
});
});
});
</script>
如果我给出这个,添加到购物车 不起作用。在 prototype.js 的 Console 中出现以下错误,
Uncaught TypeError: Object [object Object] has no method 'attachEvent'
Uncaught TypeError: Object [object Object] has no method 'dispatchEvent'
如果我删除,<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> 然后 添加到购物车 工作正常。但“选项卡选项”不起作用。
如何实现两者?
【问题讨论】:
-
使用 firebug 检查冲突问题。
-
" $($(this).attr('href'))"... 这真的是一个匹配任何东西的选择器吗?
-
始终为您的自定义 jquery 代码和库使用 jQuery.noConflict()。
标签: javascript php jquery magento tabs