PHP Classes

File: include/startbootstrap-clean-blog-gh-pages/startbootstrap-clean-blog-gh-pages/js/scripts.js

Recommend this page to a friend!
  Classes of Milan Jankovic   Clean Blog OOP PHP PDO   include/startbootstrap-clean-blog-gh-pages/startbootstrap-clean-blog-gh-pages/js/scripts.js   Download  
File: include/startbootstrap-clean-blog-gh-pages/startbootstrap-clean-blog-gh-pages/js/scripts.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Clean Blog OOP PHP PDO
Publish pages of a blog system
Author: By
Last change:
Date: 8 days ago
Size: 1,176 bytes
 

Contents

Class file image Download
/*! * Start Bootstrap - Clean Blog v6.0.9 (https://startbootstrap.com/theme/clean-blog) * Copyright 2013-2023 Start Bootstrap * Licensed under MIT (https://github.com/StartBootstrap/startbootstrap-clean-blog/blob/master/LICENSE) */ window.addEventListener('DOMContentLoaded', () => { let scrollPos = 0; const mainNav = document.getElementById('mainNav'); const headerHeight = mainNav.clientHeight; window.addEventListener('scroll', function() { const currentTop = document.body.getBoundingClientRect().top * -1; if ( currentTop < scrollPos) { // Scrolling Up if (currentTop > 0 && mainNav.classList.contains('is-fixed')) { mainNav.classList.add('is-visible'); } else { console.log(123); mainNav.classList.remove('is-visible', 'is-fixed'); } } else { // Scrolling Down mainNav.classList.remove(['is-visible']); if (currentTop > headerHeight && !mainNav.classList.contains('is-fixed')) { mainNav.classList.add('is-fixed'); } } scrollPos = currentTop; }); })