• 0

How to disable unused footer scripts like parallax, fitvids, waypoints etc. for best performance?


Question

Posted · Report post

In the footer of my site there is:
 

<!-- Footer Scripts -->
<script type='text/javascript' src='http://malmgord.dev/wp-content/themes/dms/js/script.bootstrap.min.js?ver=2.2.2'></script>
<script type='text/javascript' src='http://malmgord.dev/wp-content/themes/dms/js/script.resize.js?ver=1.1.6'></script>
<script type='text/javascript' src='http://malmgord.dev/wp-content/themes/dms/js/script.viewport.js?ver=1.1.6'></script>
<script type='text/javascript' src='http://malmgord.dev/wp-content/themes/dms/js/script.waypoints.js?ver=1.1.6'></script>
<script type='text/javascript' src='http://malmgord.dev/wp-content/themes/dms/js/script.easing.js?ver=1.1.6'></script>
<script type='text/javascript' src='http://malmgord.dev/wp-content/themes/dms/js/script.fitvids.js?ver=1.1.6'></script>
<script type='text/javascript' src='http://malmgord.dev/wp-content/themes/dms/js/parallax.js?ver=1.1.6'></script>
<script type='text/javascript' src='http://malmgord.dev/wp-content/themes/dms/js/pl.common.js?ver=1.1.6'></script>
<script type='text/javascript' src='http://malmgord.dev/wp-content/themes/dms-child/sections/navbar/navbar.js?ver=1.1.6'></script>

Two questions:
1. Why is DMS loading i.e. parallax.js when I'm not using it? Are there plans to optimize it so that only scripts that are needed by sections currently on the page are loaded?
2. How can I disable the ones I'm not using? Probably somehow in my child-themes functions.php?

 

 

Thanks! :)

Share this post


Link to post
Share on other sites

2 answers to this question

  • 0

Posted · Report post

Hi there,

 

As far as I'm aware these scripts can be used inside certain sections or section areas so they'll load in the footer area after the main page content has loaded. Scripts will only be loaded if they're essential or required on the page, when developing the core team work on the basis that the theme only loads what's required. They'll be improvements in future editions as the theme moves forward.

 

You can disable any scripts using the hook provided in this link http://forum.pagelines.com/topic/30739-can-fitvidsjs-be-disabled-from-the-theme/

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Scripts will only be loaded if they're essential or required on the page, when developing the core team work on the basis that the theme only loads what's required.

So does this mean that loading unnecessary scripts is a bug and it's being worked on at some point?

That's good. Thanks. And until then I can use function you linked.

Share this post


Link to post
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