How to enable CSS position: sticky in mobile browsers?

坚强是说给别人听的谎言 提交于 2021-01-21 12:23:31

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/45249771/how-to-enable-css-position-sticky-in-mobile-browsers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!