The distribution of magnetic fields of positive and negative polarities over the surface of the Sun was studied on the basis of synoptic maps presented by the NSO/Kitt Peak (1978-2016). To emphasize the contribution of weak fields the following transformation of synoptic maps was made: for each synoptic map only magnetic fields with modulus less than 5G ($|B|\leq 5$G) were left unchanged while larger or smaller fields were replaced by the corresponding threshold values +5G or $-5$G. Cyclic variations of the magnetic field polarity have been observed associated with two types of magnetic field flows in the photosphere. Rush-to-the-Poles (RTTP) appear near the maximum of solar activity and have the same sign as the following sunspots. The lifetime of RTTP is $\sim 3$ yrs, during which time they drift from latitudes $30^\circ$-$40^\circ$ to the pole, causing the polarity change of the Sun's polar field. Our aim is the study of another type of variations which has the form of series of flows with individual flows of 0.5-1 yr with alternating polarity. These flows called ripples are located in time between two RTTP and drift from the equator to the latitudes of $~50^\circ$. The period of variation of ripples was shown to be 1.1 yr for the northern hemisphere and 1.3 yr for the southern hemisphere. It was found that the amplitude of variation was higher for the time intervals where the polar field had a positive sign. Within the same flow, fields of positive and negative signs developed in anti-phase. Two types of flows - RTTP and ripples - together formed a unique structure which had close connection to the magnetic solar cycle.