PageSourceSearch

https://gaohaoyang.github.io/js/main.js

js gaohaoyang.github.io collected 2026-10-03 09:13:32 UTC 1,661 bytes, 63 lines download raw bytes

1/**
2 * some JavaScript code for this blog theme
3 */
4/* jshint asi:true */
5
6/////////////////////////header////////////////////////////
7/**
8 * clickMenu
9 */
10(function() {
11  if (window.innerWidth <= 770) {
12    var menuBtn = document.querySelector('#headerMenu')
13    var nav = document.querySelector('#headerNav')
14    menuBtn.onclick = function(e) {
15      e.stopPropagation()
16      if (menuBtn.classList.contains('active')) {
17        menuBtn.classList.remove('active')
18        nav.classList.remove('nav-show')
19      } else {
20        nav.classList.add('nav-show')
21        menuBtn.classList.add('active')
22      }
23    }
24    document.querySelector('body').addEventListener('click', function() {
25      nav.classList.remove('nav-show')
26      menuBtn.classList.remove('active')
27    })
28  }
29}());
30
31//////////////////////////back to top////////////////////////////
32(function() {
33  var backToTop = document.querySelector('.back-to-top')
34  var backToTopA = document.querySelector('.back-to-top a')
35  // console.log(backToTop);
36  window.addEventListener('scroll', function() {
37
38    // 页面顶部滚进去的距离
39    var scrollTop = Math.max(document.documentElement.scrollTop, document.body.scrollTop)
40
41    if (scrollTop > 200) {
42      backToTop.classList.add('back-to-top-show')
43    } else {
44      backToTop.classList.remove('back-to-top-show')
45    }
46  })
47
48  backToTopA.addEventListener('click',function (e) {
49      e.preventDefault()
50      window.scrollTo({
51        top: 0,
52        behavior: 'smooth'
53    })
54  })
55}());
56
57//////////////////////////hover on demo//////////////////////////////
58(function() {
59  var demoItems = document.querySelectorAll('.grid-item')
60}());
61
62
63

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.