Jump to content
thirty bees forum
  • 0

Uses Passive Event Listeners to Improve Scrolling Performance, should we care?


the.rampage.rado

Question

I stumbled upon an easy fix that is recommended a lot online for this notice in Google Page Speed and I would like to ask the members with coding if it works and should we really care about this notice?

https://github.com/zzarcon/default-passive-events

I'm using it by adding this code to Custom code of my thirtybees and when checking with the tool this notice is gone. There are comments online that this file should be loaded before everything else .js and not on the end of the page as we move them with thirtybees. I'm unable to observe any scrolling improvement (or I'm not looking where I should)... Of course one less line in the Google report means the report gathers 1 point overall, not much but in the end if this works it's a five minute job.

 

<script type="text/javascript" src="https://unpkg.com/default-passive-events"></script>



If this works could we implement this tiny .js file locally to avoid using one more connection to external CDN?

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Try add code to header.tpl in your theme directory:

<script defer type="text/javascript" src="https://unpkg.com/default-passive-events"></script>
{if isset($js_defer) && !$js_defer && isset($js_files) && isset($js_def)}
    {$js_def}
    {foreach from=$js_files item=js_uri}
            <script defer type="text/javascript" src="{$js_uri|escape:'html':'UTF-8'}"></script>
    {/foreach}
{/if}

 

Edited by Adik
Link to comment
Share on other sites

  • 0

I personally don't like this kind of blanket/site wide solution. What if there is some module that actually want to prevent scroll events, for example some module that implements infinite scroll functionality? This could easily break it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...