The Democrats were pro slavery/ segregation and Republicans were anti slavery/segregation  argument doesn't really work because nobody who is alive today had anything to do with slavery and almost nobody is still alive who had anything to do with enforcing segregation.  

Similarly it is not true that the Democrats and Republicans simply switched. Both parties have always had conservative and liberal wings to them. Both have had tolerant and intolerant elements. The fact is that the most racist Americans have largely died off. The Civil Rights Act of the 1960's didn't turn the South Republican. Democrats still held the majority of seats in the South in the 1970s , the 1980s right up to 1994. So basically the racist pro jim crow democrats simply died.