I think what you are selecting is wrong and before() appends elements.
$(this).parent().prev('.step').css("background" , "url("+src+")");
basic explanation
$(this) //the image
.parent() // the div #images
.prev('.step') //get the previous sibling with the class step
.css("background" , "url("+src+")");
If you want all of the .step elements, you would use .siblings(".step")
instead of .prev(".step")