1
0
mirror of https://github.com/ruanyf/es6tutorial.git synced 2025-05-29 05:42:20 +00:00

add page flip

This commit is contained in:
ruanyf 2014-04-29 19:50:42 +08:00
parent b6d48677e3
commit 74e232b220

View File

@ -39,17 +39,6 @@ function initialize() {
// page router // page router
router(); router();
$(window).on('hashchange', router); $(window).on('hashchange', router);
$(document).on('scroll', function (evt) {
var newScroll = $(document).scrollTop(),
diff = newScroll-lastScroll;
treshold = (treshold+diff>headerHeight) ? headerHeight : treshold+diff;
treshold = (treshold < 0) ? 0 : treshold;
header.css('bottom', (-treshold)+'px');
lastScroll = newScroll;
}
} }
function init_sidebar_section() { function init_sidebar_section() {
@ -245,5 +234,15 @@ function router() {
}).always(function() { }).always(function() {
clearInterval(loading); clearInterval(loading);
$(ditto.loading_id).hide(); $(ditto.loading_id).hide();
}); $(document).on('scroll', function (evt) {
var newScroll = $(document).scrollTop(),
diff = newScroll-lastScroll;
treshold = (treshold+diff>headerHeight) ? headerHeight : treshold+diff;
treshold = (treshold < 0) ? 0 : treshold;
header.css('bottom', (-treshold)+'px');
lastScroll = newScroll;
}
});
} }