我发誓这应该可行,但事实并非如此。我必须失去了一些东西简单:增量式CSS定位不起作用
HTML:
<div id="box"></div>
CSS:
#box {
position: absolute;
background: blue;
width: 200px;
height: 200px;
left: 20px;
top: 20px;
}
的JavaScript:
$('#box').click(function(e) {
if (e.shiftKey)
$(this).css('left', '70px');
else
$(this).css('left', '+=50');
});
如果你按住Shift并单击,该框移动正如它应该。尝试点击不换班,并且该框不会将其左边缘位置增加50px。是什么赋予了?
这是一个jQuery错误,我正在努力寻找一个链接。这里曾问过很多次。 – thirtydot
[在jQuery 1.6.1中使用箭头键移动div不起作用](http://stackoverflow.com/questions/5983034/move-div-with-arrow-key-in-jquery-1-6- 1-does-not-work) – thirtydot