In this fiddle http://jsfiddle.net/mjmitche/6nar4/3/, if you drag, for example, the little blue box into the yellow box, then the big black box will turn pink. All of the 4
Also, the ternary operator expects expressions, not statements. Do not use semicolons, only at the end of the ternary op.
$("#blackbox").css({'background': $("#blackbox").css('background') === 'pink' ? 'black' : 'pink'});