Edit JS code in slider revolution

Cloudflare Rocket loader is interfering with my slider revolution


(Note have already added page rule to disable/bypass perfomance velocitywebsites.co.nz/x/)

Do you have any ideas on where I would find the script below in my files so I can add the line of code??

Cloudflare Support
How can I have Rocket Loader ignore my script(s) in Automatic Mode?

You can have Rocket Loader ignore individual scripts by adding the data-cfasync=“false” attribute to the relevant script tag, for example:

  <script data-cfasync="false" src="/javascript.js"></script>      

Rocket Loader will still work for all other scripts.

Notes:

  1. Adding this attribute within JS will not work to exclude the script from Rocket Loader.
  2. The ‘data-cfasync’ attribute must be added before the ‘src’ attribute.
  3. Rocket loader will recognize the tag when either single or double quotes are placed around the attribute value.
    Alternative:
    If Rocket Loader is only impacting a specific URL, then please look at using a PageRuleto exclude that URL from optional performance features.

all good its working now

Hi There,

Please instal and activate the child theme.

After that add the following code under functions.php file locates in your child theme:

function add_script_attrs( $script, $type ) {
 
    if( $type === 'tp-tools' || $type === 'revmin' ) {
 
        $script = str_replace( 'src=', 'data-cfasync="false" src=', $script );
 
    }
 
    return $script;
 
}
 
if( !is_admin() ) {
 
    add_filter( 'script_loader_tag', 'add_script_attrs', 10, 2 );
 
}

Hope it helps :slight_smile:

1 Like

Not sure where that was meant to go. I put it in the functions.php file but it appeared at the top of the screen. So I put it in the edit Gloabl Javascript in the customizer??

the fade in is not appearing in chrome but is appearing in chome private browsing??

slider rev is appearing in chrome but not private browsing mode??

Have I put that script in correctly?

Hi There,

Place the given code on your child theme’s functions.php file.

Please clear the CloudFlare’s cache, clear your caching/minifier plugins, and your browser’s cache.

Cheers!

Yes that worked well in Rocked Loader " Manual"

Glad it worked now, the rocket loader affects the loading order of the scripts, hence, high change of errors. Thanks!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.