WPBuddy / largo

A WordPress framework for news websites. Finely-crafted by INN and expertly-honed and maintained by the technology team at WP Buddy.
http://largo.wpbuddy.co
GNU General Public License v2.0
170 stars 83 forks source link

Floating social buttons flash on barely-long-enough posts: an edge case #1304

Open benlk opened 8 years ago

benlk commented 8 years ago

The floating social buttons will display as long as both the top and bottom offset were offscreen, which could happen for as little as 2 pixels' scrolling distance if a posts is barely long enough.

The fix for this is contained in https://github.com/nprds/editorial-wp-site/pull/25 (private repo), but consists of the following change in floating-social-buttons.js

-    if (scrollTop > offsets[0] && scrollBottom < offsets[1])
-      return true;
+    if (scrollTop > offsets[0] && scrollBottom < offsets[1]) {
+      if ( ( offsets[1] - offsets[0] ) > ( window.innerHeight * 2 ) ) {
+        return true;
+      }
+    }

Should we implement this in Largo?

benlk commented 5 years ago

prevent floating social buttons from flashing on barely-long-enough posts