Cache vars in max viewport js for perf tweak