Skip to content

Instantly share code, notes, and snippets.

@black-black-cat
Last active April 3, 2017 04:00
Show Gist options
  • Save black-black-cat/2fddc9f800789ee923ea25b2febad148 to your computer and use it in GitHub Desktop.
Save black-black-cat/2fddc9f800789ee923ea25b2febad148 to your computer and use it in GitHub Desktop.
去除 msn 顶部菜单
// ==UserScript==
// @name msn header
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.msn.com/*
// @grant none
// ==/UserScript==
(function(win, $) {
'use strict';
$(onReady);
function onReady() {
console.log('monkey');
var $nav = $('#nav');
var $header = $('#header-common');
var $container = $header.closest('.head');
var folded = false;
$('.normalsection.loaded').hide();
// Your code here...
var handlers = {
scroll: [
function k() {
console.log(document.body.scrollTop, folded);
if (document.body.scrollTop === 0) {
$container.css({ height: 'auto' });
$nav.show();
$nav.css({ top: 'auto' });
folded = false;
return;
}
if (folded) {
return;
}
$container.css({ height: 0 });
$header.hide();
$nav.css({ top: 0 });
folded = true;
}
]
};
var check = handlers.scroll[0];
check();
win.addEventListener('scroll', check);
}
})(window, window.$);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment