How to enable CSS position: sticky in mobile browsers?

Ulukbek Abylbekov picture Ulukbek Abylbekov · Jul 22, 2017 · Viewed 14.7k times · Source

Added some position: sticky property to my webpage. On Desktop browser work fine but sucks in mobiles.

Answer

Cezar Augusto picture Cezar Augusto · Jul 22, 2017

sticky property for Chrome and Safari for iOS needs to be set with -webkit vendor first:

.element {
  position: -webkit-sticky;
  position: sticky;
}

You can check about browser compatibility in canIUse