title
I think this article on LiveScience, admittedly quoting only one historian (Eric Rauchway), gives a good overview of how the Republicans and Democrats broadly appeared to 'switch platforms' between the 1860s and the 1930s.
Thus the Democrats transitioned from favouring small-government policy to favouring big-government policy - a position they maintained, and best encapsulated in President Franklin D. Roosevelt's 'New Deal' platform in the Thirties. The Republicans, who throughout had represented the interests of big business, gradually adopted the counter-position of favouring small federal government.
This is useful background for understanding broadly why the Democrats were willing to - eventually - go forward with bills on Civil Rights (1964) and Voting Rights (1965) for the US' African-American population.
Chasing votes in the West at the turn of the century had prompted the shift in the Democrats' position (per the above article). It might be taken as a cynical vote-winning stance, but the full enfranchisement of black people in the US fit better with the Democrats' ideas of big government.
The Republicans, with the likes of presidential candidate and senator Barry Goldwater, came to represent the small-government proponents. Southern states wanted to be left alone by a federal government who they perceived as ignorant of the southern way of life (e.g. Jim Crow laws).
It could be argued more cynically that, both at the end of the Civil War and during the mid-1960s, two US administrations were presented with opportunities to vastly expand their support base overnight (i.e. enfranchise African-Americans) - and both took it. The former was a Republican administration, the latter was a Democrat administration.
This is a very simplistic answer, but I hope it provides some overview.
Further reading that will probably be much more enlightening:
• How Republicans and Democrats switched on civil rights - Medium
• Why Did Black Voters Flee The Republican Party In The 1960s? - NPR