mirror of
https://github.com/AlekseyLobanov/AlekseyLobanov.github.io.git
synced 2026-01-12 13:12:03 +03:00
First
This commit is contained in:
13
theme/js/custom_scripts.js
Normal file
13
theme/js/custom_scripts.js
Normal file
@@ -0,0 +1,13 @@
|
||||
(function() {
|
||||
function onScroll(e) {
|
||||
var sidebar = document.getElementById('sidebar-container-fixed');
|
||||
if (window.scrollY > 0) {
|
||||
sidebar.style.width = sidebar.offsetWidth + 'px'
|
||||
sidebar.classList.add('sticky');
|
||||
} else {
|
||||
sidebar.style.width = 'auto'
|
||||
sidebar.classList.remove('sticky');
|
||||
}
|
||||
}
|
||||
document.addEventListener('scroll', onScroll);
|
||||
})();
|
||||
Reference in New Issue
Block a user