Working css transitions with jQuery event handling