Kar*_*Sho 1 javascript php jquery tabs magento
我使用的标签选项在我 C:\wamp\www\magento\app\design\frontend\base\default\template\catalog\product\view.phtml,与下面的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>
Run Code Online (Sandbox Code Playgroud)
如果我这样做,添加到购物车是行不通的.从prototype.js在控制台中给出以下错误,
Uncaught TypeError: Object [object Object] has no method 'attachEvent'
Uncaught TypeError: Object [object Object] has no method 'dispatchEvent'
Run Code Online (Sandbox Code Playgroud)
如果我删除,<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>那么添加到购物车工作正常.但'Tab选项'不起作用.
我如何实施两者?
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script>jQuery.noConflict()</script>
<script>
jQuery(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>
Run Code Online (Sandbox Code Playgroud)