I read the following article by CSS Tricks https://css-tricks.com/prevent-page-scrolling-when-a-modal-is-open/ and decided that my website shouldn’t scroll whilst the lightbox is shown, i.e. on the Blog and the Memories pages when an image is clicked.
I use the Featherlight plugin on my Blog and the equivalent for the Memories page.
I added the following CSS to my Blog, which now means that the page will not scroll whilst the lightbox is open, but sticky elements like the navbar and the sidebar will stay in place. Similar code was added across the rest of the site.
html {
position: relative!important;
overflow-x: hidden;
}
html.with-featherlight {
overflow-y: hidden;
width: 100%;
}
html.with-featherlight body {
overflow-y: scroll;
}
html.with-featherlight nav.featherlight-fix {
position: fixed;
margin-top: 0;
left: 0;
}
html.with-featherlight #sidebar.featherlight-fix ul:first-child {
position: fixed;
}
html.with-featherlight .cc-window.cc-banner.cc-type-info.cc-theme-edgeless.cc-bottom.cc-color-override--591744288 {
width: calc(100% - 17px);
}
@media (max-width: 830px) {
html.with-featherlight nav {
margin-top: 0px;
}
.featherlight-previous, .featherlight-next {
display: none!important;
}
html.with-featherlight #sidebar ul:first-child {
position: -webkit-sticky;
position: sticky;
}
html.with-featherlight .wrap {
margin-top: 50px;
}
}
@media (max-width: 830px) {
html.with-featherlight nav {
margin-top: 0px;
}
}
@media (max-width: 1100px) and (min-width: 830px) {
html.with-featherlight header.featherlight-fix {
margin-bottom: 68px;
}
html.with-featherlight nav {
margin-top: 0;
margin-bottom: -7px;
}
}
Whilst experimenting with this I found that the built-in WordPress galleries did not work on Safari 10.1. I then filed a bug report which you can follow here: https://core.trac.wordpress.org/ticket/47744