Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi,

    Add this css to style.css

    .header-wrapper {
        position: fixed;
        width: 100%;
        z-index: 999;
    }
    .header-wrapper.sticky img {
        height: 54px;
        margin-top: -10px;
    }

    Add this code in header.php

    $(window).scroll(function() {
    if ($(this).scrollTop() > 1){  
        $('.header-wrapper').addClass("sticky");
      }
      else{
        $('.header-wrapper').removeClass("sticky");
      }
    });

    Sticky header on scroll looks like this
    https://prntscr.com/cee7pz

    • This reply was modified 8 years, 2 months ago by wpressdr.
    Thread Starter jarrodroney

    (@jarrodroney)

    Okay i can add those, but i’m not entirely sure exactly where in style.css and header.php to add these codes. I tried adding them at the top of of each of those and all I got was coding visible at the top of my blog page.

    Where exactly do I place the codes?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding a fixed header to my Wp blog’ is closed to new replies.