我正在尝试使用hammer.js实现水平滑动。但我一直收到这个错误:
未捕获的ReferenceError:$未定义(匿名函数。
它会是什么?
代码: https://jsfiddle.net/6d88314h/
功能:
@charset "utf-8";
/* CSS Document */
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
/* header elements */
.header-container {
width: 100%;
}
.header-area {
height: 35px;
width: 100%;
background-color: #bb0700;
padding-right: 0px;
}
.logo-ads {
height: 110px;
width: 1000px;
background-color: #CFD1A9;
padding-right: 0px;
margin-top: 0px;
margin-right: auto;
margin-left: auto;
margin-bottom: 0px;
z-index: 0;
}
.left {
float: left;
height: 110px;
width: 30%;
background-color: #F9F9E4;
padding-right: 0px;
margin-top: 0px;
margin-right: auto;
margin-left: auto;
margin-bottom: 0px;
box-sizing: border-box;
}
.right {
float: right;
width: 70%;
height: 110px;
}
.navigation {
height: 35px;
width: 1000px;
background-color: #2A2929;
padding-right: 0px;
margin-top: 0px;
margin-right: auto;
margin-left: auto;
margin-bottom: 0px;
color: #fff;
z-index: 1;
}
.main {
height: 1000px;
width: 1000px;
background-color: #F7E3E3;
padding-right: 0px;
margin-top: 0px;
margin-right: auto;
margin-left: auto;
margin-bottom: 0px;
z-index: 2;
}
.footer-container {
height:35px;
width: 1000px;
background-color: #F2F1F1;
padding-right: 0px;
margin-top: 0px;
margin-right: auto;
margin-left: auto;
margin-bottom: 0px;
z-index: 3;
}
.footer-end {
height: 35px;
width: 1000px;
background-color: #bb0700;
padding-right: 0px;
margin-top: 0px;
margin-right: auto;
margin-left: auto;
margin-bottom: 0px;
z-index: 4;
}
答案 0 :(得分:2)
您需要在页面中添加jQuery:
<script src="https://code.jquery.com/jquery-3.1.0.min.js"></script>