Files
vij/scripts/main-arrow.js

27 lines
606 B
JavaScript
Raw Permalink Normal View History

2021-12-28 23:31:56 +03:00
var windw = this;
var wrapper = document.getElementById('main');
var sticky = document.getElementById('main');
$.fn.followTo = function ( ) {
var $this = this,
$window = $(windw);
var pos = wrapper.scrollHeight;
$window.scroll(function(e){
if ($window.scrollTop() >= wrapper.scrollHeight - 130) {
$this.css({
position: 'absolute',
top: pos
});
} else {
$this.css({
position: 'fixed',
top: ''
});
}
});
};
$('#main-arrow').followTo();