From the Super Mario Wiki
Dangling Ghosts are enemies encountered in World 5 of Super Mario World 2: Yoshi's Island. Resembling Caged Ghosts, they swing back and forth on the ceiling similarly to a pendulum, in an attempt to hit the Yoshi or Baby Mario. If they succeed, they will grab and hold Baby Mario in their jaws, leading to him needing rescued. They can be defeated temporarily using the usual method (spitting another enemy at them or shooting an egg), and they'll retract, allowing the player to pass through. After a few seconds, they will return to their constant swinging back and forth.
They also appear in Yoshi's New Island.
Names in other languages