Ok I did it, it had nothing to do with caching. I was unable to get the suggested solution to work. I suspect it has to do with the nature of iframes.
That said, I found a working solution.
In the MVC application, you can access the boolean property HttpContext.Current.Kentico().Preview().Enabled;
to determine whether the page is being rendered via pagebuilder.
Solution:
In PageTemplateLayout.cshtml
@using Kentico.Content.Web.Mvc
...
...
@{
...
bool PreviewMode = HttpConteext.Current.Kentico().Preview().Enabled;
}
...
...
<header class="other-classes @(PreviewMode ? "page-builder" : string.Empty)">
...
</header>
...
<!-- body -->
...
<footer class="other-classes @(PreviewMode ? "page-builder" : string.Empty)">
...
</footer>
then in your scss (assuming you're setting constants in a _variables.scss
file)
header,footer {
&.page-builder {
z-index: $your-z-value
}
}