Modular page, markup different places in the output

Hey

I have a problem using modular pages that I can´t get my head around:

I have a one page site. This is created using a modular setup.

To make it even more complex, I have nested modular pages:

  • Level1 (main)
    • Level2 (gallery header)
      • Level 3 (gallery image)

The problem is that in level 3, I have a modal popup, But this modal window gets wrapped inside the “level 2” block.

How can I make something like this:

  • Level1 (main)
    • Level modal for all images is Level 3
    • Level2 (gallery header)
      • Level 3 (gallery image)

Hope that this question is understandable. I find this hard to explain…

Håkon