JS StickyContent - not fixed after reload


Topic: JS StickyContent - not fixed after reload

Volodymyr Yatsynych pro asked 8 years ago

Hello, Create sticky
$(".sticky").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);
$('html').scrollTop($htmlPos);
What a good solution to this?
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() {
    $(".test").sticky({
        topSpacing: 0,
        zIndex: 2,
        stopper: "bottom"
    });
}
});
and add class to your sticky content for example:
<div class="sticky position">
    <h2>Sticky Element</h2>
...
</div>
.position {
	position: fixed;
	top: 118px;
}
Regards, Adrian
Please insert min. 20 characters.

FREE CONSULTATION

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

Status

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
Tags