"We've been top since November 24 and it's a long time to be there and be shot at, discussed, debated - I'm very pleased with the mental strength of our players to deal with that," Mackay told Sky Sports News.
"We were up against a side who need to win games to stay out of the relegation zone so we knew it would be a battle.
"You have to keep entering into those battles and eventually you start to win them. We kept at it and got the result we deserved."
Saturday's victory has moved Cardiff nine points clear of third-placed Watford in the table.