res:plugins:dynamicfadein
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| res:plugins:dynamicfadein [2025/05/11 22:41] – [Download] fraenkiman | res:plugins:dynamicfadein [2025/05/12 12:38] (current) – [Download] fraenkiman | ||
|---|---|---|---|
| Line 7: | Line 7: | ||
| This can be particularly useful when extensive [[res: | This can be particularly useful when extensive [[res: | ||
| + | The plugin works with any theme/style that uses the Leggero theme templates. | ||
| + | |||
| + | Demo: [[https:// | ||
| ==== Fade-in behavior ==== | ==== Fade-in behavior ==== | ||
| {{: | {{: | ||
| Line 14: | Line 17: | ||
| **1. quick display of the header** | **1. quick display of the header** | ||
| - | | + | * The red header (the element with id=“head”) is displayed in just under 0.3 seconds during the DOMContentLoaded event using CSS variables (--fade-duration: |
| - | - This can be seen in the immediately visible background box “FlatPress” in the screenshot. | + | |
| **2. adaptive delay for the main area** | **2. adaptive delay for the main area** | ||
| - | | + | * For the load event, the script uses the Network Information API (or fallback via TTFB) to measure whether the connection is “fast”, “medium” or “slow” and whether the visitor has been there before. |
| - | - This results in a delay (“delayBody”) and a fade duration: | + | |
| - | - fast (e.g. WLAN, 4G): Fade 0.3-0.5 s, delay ~100 ms for new visitors (0 ms for returning visitors) | + | |
| - | - medium (e.g. 3G): Fade 0.8-1.2 s, delay 500-800 ms / 0-500 ms | + | |
| - | - slow (2G/slow 3G): Fade 1.5-2 s, Delay 1.5-2 s / 0-1.5 s | + | |
| - | - After delayBody has expired, the loaded class is set to the < | + | |
| + | |||
| + | * After delayBody has expired, the loaded class is set to the < | ||
| **3. lazy fade-in of the outer container** | **3. lazy fade-in of the outer container** | ||
| - | | + | * The # |
| - | - This is done by an IntersectionObserver. As soon as outer-container is in view, the script again waits for an adaptive delay (“delayOuter”, | + | |
| - | - This allows the large content to be displayed only when the user scrolls to it properly, and not all at once. | + | |
| **4. exceptions and fallbacks** | **4. exceptions and fallbacks** | ||
| - | | + | * Bots, “Save-Data”, |
| - | - Polyfill: If the IntersectionObserver API is missing, the script automatically loads a polyfill and falls back to a pure time delay in case of doubt. | + | |
| + | * Polyfill: If the IntersectionObserver API is missing, the script automatically loads a polyfill and falls back to a pure time delay in case of doubt. | ||
| ==== Benefits | ==== Benefits | ||
| Line 42: | Line 48: | ||
| **Perceived performance** | **Perceived performance** | ||
| - | | + | * Faster visible header already at DOM-Ready increases the feeling that the page loads quickly. |
| **Optimized for specific networks and devices** | **Optimized for specific networks and devices** | ||
| - | | + | * Fade duration and delay automatically adapt to connection speed (fast/ |
| **Reduced distraction for returners** | **Reduced distraction for returners** | ||
| - | | + | * As soon as it is recognized that someone already knows the page, “Delay” is eliminated and content fades in even more quickly. |
| **Lazy loading effect** | **Lazy loading effect** | ||
| - | | + | * Only when the actual post container enters the viewport does it start to fade in. This keeps the first impression lean and does not overload it with all the content at once. |
| **Accessibility & respect for user preferences** | **Accessibility & respect for user preferences** | ||
| - | | + | * For bots, with “Save-Data” or prefers-reduced-motion, |
| **Fallback security** | **Fallback security** | ||
| - | | + | * IntersectionObserver polyfill and simple time delays ensure that older browsers reliably show at least a timed fade-in effect. |
| **Increasing engagement** | **Increasing engagement** | ||
| - | | + | * The gentle dragging in of content has a modern look and invites users to read on - users stay on the page longer. |
| ==== Download ==== | ==== Download ==== | ||
| - | {{ res: | + | {{ res: |
| ===== Changelog ===== | ===== Changelog ===== | ||
| + | == 2025-05-11: Version 1.1.0 == | ||
| + | * Better UX through real-time network profiling and viewport detection | ||
| + | * Animations are skipped for bots, in save data mode and with reduced motion preference | ||
| + | * Future-proof thanks to polyfills and fallbacks | ||
| + | |||
| == 2025-02-11: Version 1.0.1 == | == 2025-02-11: Version 1.0.1 == | ||
| * iPhone with Safari is now recognized correctly | * iPhone with Safari is now recognized correctly | ||
res/plugins/dynamicfadein.1746996104.txt.gz · Last modified: by fraenkiman
