I'm not sure exactly what you mean by "on the same side".
For simplicity let's suppose the moons are in circular orbits, so their motions are uniform on the circle, in the same plane and in the same direction, with periods $p_1 < p_2$. At time $t$ they are at angular positions $\theta_1(t) = \theta_1(0) + 2 \pi t/p_1$ and $\theta_2(t) = \theta_2(0) + 2 \pi t/p_2$. The angle between them is $\theta_1(t) - \theta_2(t) = A + B t$ where $A = \theta_1(0) - \theta_2(0)$ and $B = 2 \pi (1/p_1 - 1/p_2)$. The time between conjunctions (when they are in the same direction) is $$C = 2 \pi/B = 1/(1/p_1 - 1/p_2) = p_1 p_2/(p_2 - p_1)$$
Time $C/2$ after a conjunction, they are in opposition (in opposite directions).