Quantum anomalous Hall effect in atomic crystal layers from in-plane magnetization