0
我正在尝试使用jQuery和MooTools的基本网页。jQuery/Mootools冲突错误
你可以在这里看到一个工作示例:http://jsfiddle.net/DddQA/
但是,任何时候我尝试引用MooTools的,它borks我的网页。
这里是我当前的代码,我有问题有:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.5.1rc1.min.js"></script>
<script type="text/javascript">
<!-- remove this line below to make the hyperlink box work correctly -->
jQuery.noConflict();
//<![CDATA[
$(window).load(function(){
$(".affiliate-scheme").click(function(){
window.location=$(this).find("a").attr("href");
return false;
});
});//]]>
</script>
<!-- remove this line below to make the hyperlink box work correctly -->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/mootools/1.4.5/mootools-yui-compressed.js"></script>
</head>
<body id="affiliate-scheme">
<div class="affiliate-scheme" style="background:red">
<h3>Affiliate Scheme</h3>
<ul>
<li><a href="/affiliate-scheme/" title="Promote with our Affiliate Scheme">Promote Us</a></li>
</ul>
</div>
</body>
</html>
非常感谢您的帮助这里。非常感谢。
使用'jQuery.noConflict();' – Dhiraj
谢谢,DHIRAJ。你能解释我如何在我的例子中使用它?我到目前为止所尝试的所有东西都没有奏效:/谢谢。 – michaelmcgurk
我知道你知道,但不要使用两个不同的库 - 选择一个并使用它。 –