javascript/jquery 的新手。
我收到以下错误...
“未捕获的引用错误:$ 未定义”
它似乎在以下脚本的第一行...
$('#button').toggle(
function(){
$('#menu-bar').animate({marginLeft: -200 }, 'slow', function(){
$('#button').html('Close');
});
},
function(){
$('#menu-bar').animate({marginLeft: 200 }, 'slow', function(){
$('#button').html('Menu');
});
}
);
CSS:
#button {
position: relative;
top: 0px;
left: 200px;
z-index: 100000;
width: 50px;
height: 50px;
cursor: pointer;
}
#menu-bar {
height: 100%;
width: 200px;
background-color: #2D2D2D;
position: absolute;
top: 0px;
margin-left: -200px;
padding-top: 12px;
z-index: 100;
}
和html:
<div id="menu-bar">
<div id="button">Menu</div>
<ul>
<li>
</li>
</ul>
</div>