我注意到 Magento 1.9.0.1 rwd 主题现在包含 jQuery 库并使用“jQuery.noConflict();” 默认与“$j”令牌相关联。
首先,我想使用 google CDN jQuery 库而不是本地 jQuery 库。
其次,如何运行我的 jQuery 代码?
例如,我尝试在 minicart.phtml 中插入:
.....
$_cartQty = 0;
}
?>
<script type="text/javascript">
$j(document).ready(function() {
$('#header-cart').hide();
});
</script>
<a href="#header-cart" class="skip-link skip-cart <?php if($_cartQty <= 0): ?> no-count<?php endif; ?>">
<span class="icon"></span>
........
另外,我尝试在 app.js 的末尾添加我的代码:
.....
};
$j(document).ready(function() {
ProductMediaManager.init();
});
$j(document).ready(function() {
$('#header-cart').hide();
});
但没有效果。我哪里错了?如何在 app/js 文件夹中的单独文件中运行我的代码?