If traffic prevents you from crossing all the way across a set of railroad tracks, you may proceed only when:

You must not, under any circumstances, attempt to cross railroad tracks unless you are certain that your entire vehicle will clear all of the tracks. If other traffic prevents you from going fully across, wait and cross only when there is room.
DMV Writen Test