In a transverse wave the particles of the medium, or the fields, vibrate at right angles to the direction of energy transfer. Ripples on water, all electromagnetic waves such as light and radio waves, and seismic S waves are transverse. Waves on a rope shaken up and down are too.
In a longitudinal wave the particles vibrate parallel to the direction the wave travels. Sound waves and seismic P waves are longitudinal. The particles are pushed together in regions called compressions and spread apart in regions called rarefactions, and these regions move along in the direction of energy transfer.
Electromagnetic waves can travel through a vacuum, but sound and seismic waves need a medium, because they pass energy on by vibrating particles.