Topic: JS StickyContent - not fixed after reload

Volodymyr Yatsynych pro asked 6 years ago

Hello, Create sticky
	topSpacing: 118,
	zIndex: 2,
	stopper: "bottom"
Scroll page. Reload page. Sticky element no fixed on position until not scroll page. If hack use auto scroll +/- 1px;
var $htmlPos = $('html').scrollTop();
$('html').scrollTop($htmlPos + 1);
What a good solution to this?

Adrian Sawicki free answered 6 years ago

Hi Volodymyr Yatsynych, Could you explain more precisely what effect would you like to attain? If I correctly understand you, you would like to have position: fixed all the time. You can get such effect by doing it this way:
$(function() {
        topSpacing: 0,
        zIndex: 2,
        stopper: "bottom"
and add class to your sticky content for example:
<div class="sticky position">
    <h2>Sticky Element</h2>
.position {
	position: fixed;
	top: 118px;
Regards, Adrian

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.


Specification of the issue

  • User: Pro
  • Premium support: No
  • Technology: General Bootstrap questions
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No