<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<!--<script type="text/javascript" src="js/jquery.js" ></script>-->
<script type="text/javascript" src="js/Zepto.js" ></script>
</head>
<body>
<div class="div1" style="width: 100%; height: 50px;background: red;"></div>
<div class="div2"style="width: 100%;height: 2000px;background: #009688;"></div>
<script type="text/javascript">
$(function(){
$(".div1").click(function(){
alert("a")
$("html,body").animate({"scrollTop":1500},200)
})
})
</script>
</body>
</html>
当我们同事引用了两个前段的库,都是吧$当做引用关系的时候,这两个库产生冲突 会报错$ isnot denfind
可以尝试修改
window.jQuery = window.aa = jQuery;
然后再去调用aa对象即可
<body>
<div class="div1" style="width: 100%; height: 50px;background: red;"></div>
<div class="div2"style="width: 100%;height: 2000px;background: #009688;"></div>
<script type="text/javascript">
$(function(){
$(".div1").click(function(){
alert("a")
aa("html,body").animate({"scrollTop":1500},200)
})
})
</script>
</body>