Sticky Element

How to Make an Element Sticky:

Below you will find instructions on how to make an element on page sticky. You may want to do this for example with your side rail ad units to ensure they have a higher viewability and increase revenue. 

Talk to your Customer Success manager if you have any questions around any ad units they may recommend you make sticky.

A sticky element toggles between relative and fixed, depending on the scroll position. It is positioned relative until a given offset position is met in the viewport - then it "sticks" in place (like position: fixed;).

An element with position: sticky; is positioned based on the user's scroll position. Below is an example of the code you can use. Oftentimes when we are making an ad unit sticky, you will want to make the unit sticky after the user scrolls.

div.sticky {
  position: -webkit-sticky; /* Safari */
  position: sticky;
  top: 0;
}

Note: This example does not work in Internet Explorer or Edge 15 or earlier versions as they do not support sticky positioning.