Hi and welcome to the forum
Can you post a 1 minute video of the fish swimming and resting like that?
Upload videos to YouTube, then copy & paste the link here.
Can you post a picture of the entire aquarium (assuming the picture in your original post isn't the entire tank)?
What are the tank dimensions?
Did you add anything to the tank in the 2 weeks before this started?
-------------------
Do not treat it with anything unless you know what is wrong with it.
Swim bladder problems aren't very common and there is no cure for them anyway. So don't add Melafix or anything else.
If a fish floats to the surface when it stops swimming, it could have a swim bladder problem or air in the intestine. To test this, stop feeding dry food for 1 week and feed frozen or live foods instead. If the problem rectifies itself, then the issue is air in the intestine.
If a fish sinks when it stops swimming, that is normally a swim bladder problem and there is no cure and the fish is euthanised. Some fish will eat gravel and it doesn't pass through them and that can also cause them to sink. There's no cure for this either.
A video of the fish will provide more information and it might be the fish simply likes to rest in that position (sometimes it happens). The fish might be getting bullied by the others.