The sprite slot of the item has to be between the two Yoshis (Yoshis are in slot 6 and 9 and the p-switch is in slot 7). Also the y position of the invisible Yoshi must be the same as the item and the visible Yoshi and Mario must have the same x position as the item.
...
https://www.youtube.com/watch?v=ZPoLy39Jeno