From f36e92fb7b076ab34062ae80afe79deed2541ab4 Mon Sep 17 00:00:00 2001 From: Mat Marquis Date: Thu, 26 May 2011 11:51:16 -0400 Subject: [PATCH 1/3] =?UTF-8?q?Desktop=20IE=20wasn't=20reporting=20a=20scr?= =?UTF-8?q?ollTop=20value=20for=20fixed=20headers/footers=E2=80=94'window'?= =?UTF-8?q?=20is=20now=20provided=20as=20a=20fallback=20in=20the=20event?= =?UTF-8?q?=20that=20.scrollTop()=20reports=20zero.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/jquery.mobile.fixHeaderFooter.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/js/jquery.mobile.fixHeaderFooter.js b/js/jquery.mobile.fixHeaderFooter.js index eee5476e..18d6b9d3 100644 --- a/js/jquery.mobile.fixHeaderFooter.js +++ b/js/jquery.mobile.fixHeaderFooter.js @@ -67,7 +67,19 @@ $.fixedToolbars = (function(){ stateBefore = null; } } - }) + }); + +/* + The below checks first for a $(document).scrollTop() value, and if zero, binds scroll events to $(window) instead. If the scrollTop value is actually zero, both will return zero anyway. + + Works with $(document), not $(window) : Opera Mobile (WinMO phone; kinda broken anyway) + Works with $(window), not $(document) : IE 7/8 + Works with either $(window) or $(document) : Chrome, FF 3.6/4, IE 7/8, Android 1.6/2.1, iOS + Needs work either way : BB5, Opera Mobile (iOS) + +*/ + + (( $(document).scrollTop() == 0 ) ? $(window) : $(document)) .bind('scrollstart',function(event){ scrollTriggered = true; if(stateBefore == null){ stateBefore = currentstate; } From 4947eacf1cdc372a3530bff909dbd4173112a7b3 Mon Sep 17 00:00:00 2001 From: Mat Marquis Date: Thu, 26 May 2011 12:40:49 -0400 Subject: [PATCH 2/3] Bound 'silentscroll' event back to document, as it was causing issues in modern browsers and made no difference in IE 7/8. --- js/jquery.mobile.fixHeaderFooter.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/jquery.mobile.fixHeaderFooter.js b/js/jquery.mobile.fixHeaderFooter.js index 18d6b9d3..005c6e75 100644 --- a/js/jquery.mobile.fixHeaderFooter.js +++ b/js/jquery.mobile.fixHeaderFooter.js @@ -67,7 +67,8 @@ $.fixedToolbars = (function(){ stateBefore = null; } } - }); + }) + .bind('silentscroll', showEventCallback); /* The below checks first for a $(document).scrollTop() value, and if zero, binds scroll events to $(window) instead. If the scrollTop value is actually zero, both will return zero anyway. @@ -105,8 +106,7 @@ $.fixedToolbars = (function(){ $.fixedToolbars.startShowTimer(); } stateBefore = null; - }) - .bind('silentscroll', showEventCallback); + }); $(window).bind('resize', showEventCallback); }); From 86295b170d5c6519395b44682e21b0764adc6bee Mon Sep 17 00:00:00 2001 From: Mat Marquis Date: Thu, 26 May 2011 13:00:01 -0400 Subject: [PATCH 3/3] Correcting my own comment. --- js/jquery.mobile.fixHeaderFooter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/jquery.mobile.fixHeaderFooter.js b/js/jquery.mobile.fixHeaderFooter.js index 005c6e75..34d3c992 100644 --- a/js/jquery.mobile.fixHeaderFooter.js +++ b/js/jquery.mobile.fixHeaderFooter.js @@ -75,7 +75,7 @@ $.fixedToolbars = (function(){ Works with $(document), not $(window) : Opera Mobile (WinMO phone; kinda broken anyway) Works with $(window), not $(document) : IE 7/8 - Works with either $(window) or $(document) : Chrome, FF 3.6/4, IE 7/8, Android 1.6/2.1, iOS + Works with either $(window) or $(document) : Chrome, FF 3.6/4, Android 1.6/2.1, iOS Needs work either way : BB5, Opera Mobile (iOS) */