[noun] + の間に [noun A] + と + [noun B] + の間に
の間に after a noun for a stretch of time means "during": the main clause is one event that happens at some point inside it. The noun takes の before 間に.
Without に, のあいだ間 means the main action fills the whole period, so its verb is a continuing one, often with ずっと. の間に picks out one event inside the period.
With two nouns joined by と, の間に means "between".
After a verb, 間に takes no の: こども子供がねている寝ているあいだ間に. That use is its own grammar point.