Sha256: d90ae72f24201dcac8ef424919e902477af46d767adaf788a709dd0196cc4438

Contents?: true

Size: 760 Bytes

Versions: 1

Compression:

Stored size: 760 Bytes

Contents

document.addEventListener("DOMContentLoaded", function () {
  isPC() && document.addEventListener("scroll", _dealHeadShow);
}, false);

function _dealHeadShow() {
  if (document.body.scrollTop > 300 || document.documentElement.scrollTop > 300) {
    document.getElementById("J_header").setAttribute('class', 'header-menu header-menu-overflow');
  } else {
    document.getElementById("J_header").setAttribute('class', 'header-menu header-menu-top');
  }
}

function isPC() {
  var userAgentInfo = navigator.userAgent;
  var Agents = ["Android", "iPhone", "Windows Phone", "iPad", "iPod"];
  var flag = true;
  for (var v = 0; v < Agents.length; v++) {
    if (userAgentInfo.indexOf(Agents[v]) > 0) {
      flag = false;
      break;
    }
  }
  return flag;
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cosy-jekyll-theme-1.0.5 assets/js/main.js