im嘗試在使用jQuery選擇器之前動畫定位固定。我們如何調用和動畫 :在jQuery選擇器之前,我通過調用類等知道其他方法。但我只想用jQuery來完成它。如何動畫定位固定:在選擇器之前用jQuery
HTML
<div id="main"></div>
CSS
#main {
width:200px;
height:300px;
background:#000;
}
#main:before {
content:'im before';
position:fixed;
left:0px;
top:0px;
width:40px;
height:40px;
background:blue
}
JS
$("#main").hover(function() {
$(this).animate({
"margin-left": "40px"
});
$("#main:before").animate({
"margin-left": "40px"
});
}, function() {
$(this).animate({
"margin-left": "0px"
});
$("#main:before").animate({
"margin-left": "0px"
});
});
注:認罪e給我一些沒有任何插件的解決方案
** jquery救援** ............... *不* – iConnor