From 74e232b2201e605cb034f8f358bf27d32eabb121 Mon Sep 17 00:00:00 2001 From: ruanyf Date: Tue, 29 Apr 2014 19:50:42 +0800 Subject: [PATCH] add page flip --- js/ditto.js | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/js/ditto.js b/js/ditto.js index 6fe5d44..a139c14 100644 --- a/js/ditto.js +++ b/js/ditto.js @@ -39,17 +39,6 @@ function initialize() { // page router 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() { @@ -245,5 +234,15 @@ function router() { }).always(function() { clearInterval(loading); $(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; + } + }); }