Solution: header in website with Phlox theme is no longer sticky

Problem:

Phlox header is not sticky anymore.

While visiting my website on my iPhone, I noticed that the header is not getting sticky anymore when I scrolled down. It just stayed at the top. This problem also occurred on my iPad and MacBook. I used the Safari browser on all devices. This is Apple’s default browser.

On Windows, this problem did not occur in Chrome and Firefox. Nor did it occur with the web developer toolbar open to simulate a smartphone.

I am using the latest version of the free Phlox theme and the latest version of WordPress. I am also using WP Rocket but disable this plugin doesn’t solve the problem.

Solution:

I analyzed the problem in Safari on my MacBook because it has a web developer toolbar. It turns out that the header is given the CSS property position: fixed;. This is not a problem in Chrome and Firefox, but it is in Safari. The correct value should be position: sticky;.

I solved the problem by adding this CSS snippet to the style.css file of my child theme. Remember not to edit the parent theme unless it is your own theme. This is to prevent the loss of this solution after installing a new theme update.

/* Fix the sticky topheader being sticky again in Safari browsers. */
.aux-top-sticky .site-header-section.aux-sticky {
    position: sticky;
}

Tested on:

WordPress 6.8.2 with the free Phlox theme 2.17.7

Laat een reactie achter

Je e-mailadres zal niet worden gepubliceerd. vereiste velden zijn gemarkeerd met *

Deze site gebruikt Akismet om spam te verminderen. Bekijk hoe je reactie gegevens worden verwerkt.