add main-arrow

This commit is contained in:
arlemp@selectel.ru
2021-12-28 23:31:56 +03:00
parent 5b279f70e6
commit 4d88d4133f
6 changed files with 72 additions and 6 deletions

26
scripts/main-arrow.js Normal file
View File

@@ -0,0 +1,26 @@
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();