How did the switching of the Democratic party and the Republican party happen?

by [deleted]

So I am British, and I have been hearing in the news and elsewhere on Reddit that before the Civil War, the Republicans were against slavery, and the Democrats were for it. However afterwards, the parties slowly switched and now the modern day Democrats were once the old Republicans and vice versa. Could someone confirm if this is true, and if so how did it happen?

BuenaventuraBaez