You logic is almost good, but you can not catch events for CSS in jquery.
You need to load the background image to some element. Catch the event load of that element and when it's fired you change the background image to that src and do the rest of your logic.