In Drupal 9 I have find out that the modernizr and touchevents javascript files are requested from the header instead of footer. This causes a render blocking issue while monitoring my site using GTMetrix .So, I've requested those javascript files from footer instead of header. After doing that the navigation buttons like slider next and previous buttons are not working. Either i need to make the buttons working after requesting the JS files from footer or I need another solution to solve the render-blocking issue.
Thanks in advance!
Drupal.behaviors
. If you have put your code into an onload handler, it won't break by moving the script to the footer.