garand / sticky

jQuery Plugin for Sticky Objects
Other
3.3k stars 1.06k forks source link

How to disable z-index: auto #253

Open naieem-bd opened 7 years ago

naieem-bd commented 7 years ago

when i scroll down my header goes under other sections, texts and other thing because of default z-index: auto value. when it's stick my z-index value not working cause

element.style { z-index: auto; }

now please some one tell me how to disable or remove z-index: auto value. Thanks.

benedekh commented 7 years ago

There are three possible options to solve the problem:

  1. set the zIndex argument to inherit
  2. change the default value in the source, see PR #251
  3. create a CSS class and apply that class on the sticky element.
naieem-bd commented 7 years ago

Thanks a lot Bro... :+1:

Sogl commented 7 years ago

Really strange situation. inherit didn't help me, just because the same element have z-index and inline style with z-index: inherit breaks it.

Only z-index: ... !important helped me. This library need an option to fully disable z-index property.