Title: Defer inline Javascript
Last modified: August 22, 2016

---

# Defer inline Javascript

 *  [Carlos](https://wordpress.org/support/users/ccampanya/)
 * (@ccampanya)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/defer-inline-javascript/)
 * The plugin works flawlessly but it gave me problems when I moved the loading 
   of jQuery to the footer.
 * If I do that, this script is executed BEFORE of loading jQuery:
 *     ```
       jQuery(document).ready(function(){
         var q2w3_sidebar_1_options = { "sidebar" : "sidebar", "margin_top" : 10, "margin_bottom" : 0, "screen_max_width" : 1007, "width_inherit" : true, "widgets" : ['text-31'] };
         q2w3_sidebar(q2w3_sidebar_1_options);
         setInterval(function () { q2w3_sidebar(q2w3_sidebar_1_options); }, 1500);
       });
       ```
   
 * I fixed it lowering the priority in q2w3-fixed-widget.php:57.
 * On the other hand, I have found this article which explains how to pass parameters
   to a external script (this way we wouldn’t need this inline script): [http://ottopress.com/2010/passing-parameters-from-php-to-javascripts-in-plugins/](http://ottopress.com/2010/passing-parameters-from-php-to-javascripts-in-plugins/)
 * It would be great if you can add one of these changes 🙂
 * Thanks a lot!
 * [https://wordpress.org/plugins/q2w3-fixed-widget/](https://wordpress.org/plugins/q2w3-fixed-widget/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Rick Sportel](https://wordpress.org/support/users/ricksportel/)
 * (@ricksportel)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/defer-inline-javascript/#post-5784981)
 * I’m also having a hard time getting it to work when loaded in the footer.
 * I will take a look at your second solution! Did you get it working the ‘nice’
   way?
 * Thanks for sharing.
 *  Thread Starter [Carlos](https://wordpress.org/support/users/ccampanya/)
 * (@ccampanya)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/defer-inline-javascript/#post-5784987)
 * I have not tried it yet because I don’t like to mess with plugin’s code, but 
   maybe I will try soon and share it 🙂
 *  [Rick Sportel](https://wordpress.org/support/users/ricksportel/)
 * (@ricksportel)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/defer-inline-javascript/#post-5784988)
 * I agree with you on that!
 * But… I also don’t want to move jquery to the head, just because of one plugin!
 * Maybe another way to fix it would be to copy the inline javascript the plugin
   generates to a js file and enqueue it after the plugin file.
 *  Thread Starter [Carlos](https://wordpress.org/support/users/ccampanya/)
 * (@ccampanya)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/defer-inline-javascript/#post-5785120)
 * Agreed! 🙂 That’s why I just patched it lowering the priority of the action which
   injects the javascript code.
 * I like your idea! However, I think it is not possible because the generated code
   uses the parameters from the plugin settings, but if it is ok for you to hardcode
   the values, is sounds good!
 * Said that, I’m no expert in web programming, so please, correct me if I’m wrong
   🙂

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Defer inline Javascript’ is closed to new replies.

 * ![](https://ps.w.org/q2w3-fixed-widget/assets/icon-256x256.png?rev=2384479)
 * [Fixed Widget and Sticky Elements for WordPress](https://wordpress.org/plugins/q2w3-fixed-widget/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/q2w3-fixed-widget/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/q2w3-fixed-widget/)
 * [Active Topics](https://wordpress.org/support/plugin/q2w3-fixed-widget/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/q2w3-fixed-widget/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/q2w3-fixed-widget/reviews/)

## Tags

 * [footer](https://wordpress.org/support/topic-tag/footer/)
 * [javascript](https://wordpress.org/support/topic-tag/javascript/)
 * [jquery](https://wordpress.org/support/topic-tag/jquery/)

 * 4 replies
 * 2 participants
 * Last reply from: [Carlos](https://wordpress.org/support/users/ccampanya/)
 * Last activity: [11 years, 3 months ago](https://wordpress.org/support/topic/defer-inline-javascript/#post-5785120)
 * Status: not resolved