try to take over the world!
// ==UserScript==
// @name 知乎标题隐藏
// @namespace http://tampermonkey.net/
// @version 0.2
// @description try to take over the world!
// @author You
// @match https://*.zhihu.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
document.getElementsByClassName('PageHeader')[0].style.display = 'none'
windowAddMouseWheel();
function windowAddMouseWheel() {
var scrollFunc = function (e) {
e = e || window.event;
if (e.wheelDelta) {//浏览器兼容
if (e.wheelDelta > 0) { //当滑轮向上滚动时
document.getElementsByClassName('Sticky')[0].style.display = 'block'
}
if (e.wheelDelta < 0) { //当滑轮向下滚动时
document.getElementsByClassName('Sticky')[0].style.display = 'none'
}
} else if (e.detail) {
if (e.detail> 0) { //当滑轮向上滚动时
document.getElementsByClassName('Sticky')[0].style.display = 'block'
}
if (e.detail< 0) { //当滑轮向下滚动时
document.getElementsByClassName('Sticky')[0].style.display = 'none'
}
}
};
//给页面绑定滑轮滚动事件
if (document.addEventListener) {
document.addEventListener('DOMMouseScroll', scrollFunc, false);
}
//滚动滑轮触发scrollFunc方法
window.onmousewheel = document.onmousewheel = scrollFunc;
}
})();