I swear this should work, but it’s not. I must be missing something simple:
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');
});
If you shift+click, the box moves as it should. Try clicking without shift, and the box does not increase its left edge position by 50px. What gives?
See http://bugs.jquery.com/ticket/9237
The bug will be fixed in
1.6.2.Broken: http://jsfiddle.net/Kwpuq/
Fixed: http://jsfiddle.net/Kwpuq/1/ – that’s using “jQuery (edge)”