For simplicity, let's assume that it's the wave function of an electron, but this applies to any particle.
The first problem is the question. What does "detection" means?
The technical term is "measurement", and the most important idea is that you can measure different things, for example the position of the electron, or the speed of the electron, or the energy of the electron, or ...
If you measure the exact position of an electron, the wave function collapses to a point.
But you can measure other thing, for example if it's inside a box or outside the box. In this case the wave function that initially is spread perhaps in all the universe, will collapse to a smaller wave function. In some cases to one that is completely inside the box, and in other cases one that is completely outside the box.
Knowing the initial wave function it's possible to know how the wave functions inside or outside the box will be, but the details are quite technical.
What is not possible to know if after the measurement you will get the wave function that is inside or outside the box. As fas as we know this is a random choice. Nobody likes it, some people thing there are not random rules, but most people think it's sadly random.
Note that the probability to get the wave function that is inside or outside the box are not equal. It may be la loaded "dice". The exact numbers can be calculated if you know the initial wave functions, but the details are quite technical.
Very informally, if the box is small, the probability of getting the wave function that is inside is small. If you have an electron inside the box and open it for a very short time and close it, then the probability of getting the wave function that is inside is big. To get a formal definition, you must read all the nasty technical details.
---
The idea is that you can somehow detect that the electron is inside or outside the box, but it does not collapse the wave function completely. You still have a complicated wave function inside or outside the box. And you can make this wave function colide with other wave functions and get some weird quantum mechanics results that are impossible if you assume that the wave function has collapsed for a very short time to a single point inside or outside the box.
Or you can generalize this with two boxes and the rest of the universe. It's possible to measure if the electron is in box A, box B or outside. It's also possible to measure if the electron is in any box or outside. In this case you get entangled boxes that are even weirder.
---
The experiment in the link use photon in a one or two slits experiment. The physical details are very different but the calculations and the idea is very similar. The box is the slide, and outside the box is the screen.