How would i make a frame stack upon another frame if one is enabled

image
here is an example i want it to stack above but only if there already is one but i have no idea how i would even attempt it