Getting a sticky header to “push up”, like in Instagram's iPhone app using CSS and jQuery

前端 未结 8 1383
[愿得一人]
[愿得一人] 2020-11-30 16:12

The Instagram app has a nice sticky header that pushes the current one up in place of the new one. I found a great tutorial on how to do this natively for Android, but I\'m

8条回答
  •  清歌不尽
    2020-11-30 17:00

    This doesn't always work well if there's content above the div with the sticky headers: $thisSticky.css('transform', 'translateY(' + $newPosition+ 'px)');

    But this line does the trick //could just as easily use top instead of transform $thisSticky.css('top', $newPosition+ 'px');

提交回复
热议问题