Yes, it is legal. However, it is accepted as long as you do not violate any rules. Here violation means crossing the line on the basketball court. If you do not overstep that line, then you may make all the free throws while jumping.