I would consider refactoring to separate out your functions and events. Also you are checking the window on document
ready, at which point the window object hasn't loaded anything yet (the DOM is ready before the the window renders). Try this:
jQuery(window).load(function($) {
var responsive_viewport = $(window).width();
if (responsive_viewport >= 768) {
equal_height('.cta-text');
$(window).resize(function() {
equal_height('.cta-text');
});
}
});
function equal_height(target) {
var maxHeight = -1;
$(target).each(function() {
maxHeight = maxHeight > $(this).height() ? maxHeight : $(this).height();
});
$(target).each(function() {
$(this).height(maxHeight);
});
};
I should also mention that because your resize function is within a conditional statement, it will only fire when the viewport is above 768 pixels — so make sure that you are taking that into account while debugging.