NoteOnMe博客平台搭建
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
662 B

3 years ago
  1. // Check scroll position and add/remove background to navbar
  2. function checkScrollPosition() {
  3. if($(window).scrollTop() > 50) {
  4. $(".fixed-header").addClass("scroll");
  5. } else {
  6. $(".fixed-header").removeClass("scroll");
  7. }
  8. }
  9. $(document).ready(function () {
  10. // Single page nav
  11. $('.fixed-header').singlePageNav({
  12. offset: 59,
  13. filter: ':not(.external)',
  14. updateHash: true
  15. });
  16. checkScrollPosition();
  17. // nav bar
  18. $('.navbar-toggle').click(function(){
  19. $('.main-menu').toggleClass('show');
  20. });
  21. $('.main-menu a').click(function(){
  22. $('.main-menu').removeClass('show');
  23. });
  24. });
  25. $(window).on("scroll", function() {
  26. checkScrollPosition();
  27. });