- This topic has 7 replies, 3 voices, and was last updated 4 years, 3 months ago by David.
-
AuthorPosts
-
July 11, 2019 at 1:37 am #954667Antonio
Hi,
I am using GP premium to add Hooks to a website. In the specific I have small script in the wp_head and usually I use the same on other projects and it always works.
I realised that the script is loaded only when I am logged in WordPress.
I try to deactivate all the plugins (security and cache plugins etc.) but is not solving the problem.
This is the script:
<script> jQuery(document).ready(function($){ $(document.body).on("mouseenter mouseleave", ".kg-1", function() { $('.w_01').toggle(); }); $(document.body).on("mouseenter mouseleave", ".kg-2", function() { $('.w_02').toggle(); }); $(document.body).on("mouseenter mouseleave", ".kg-3", function() { $('.w_03').toggle(); }); $(document.body).on("mouseenter mouseleave", ".kg-4", function() { $('.w_04').toggle(); }); $(document.body).on("mouseenter mouseleave", ".kg-5", function() { $('.w_05').toggle(); }); $(document.body).on("mouseenter mouseleave", ".kg-6", function() { $('.w_06').toggle(); }); $(document.body).on("mouseenter mouseleave", ".kg-7", function() { $('.w_07').toggle(); }); $(document.body).on("mouseenter mouseleave", ".kg-8", function() { $('.w_08').toggle(); }); $(document.body).on("mouseenter mouseleave", ".kg-9", function() { $('.w_09').toggle(); }); $(document.body).on("mouseenter mouseleave", ".kg-10", function() { $('.w_10').toggle(); }); $(document.body).on("mouseenter mouseleave", ".kg-11", function() { $('.w_11').toggle(); }); $(document.body).on("mouseenter mouseleave", ".kg-12", function() { $('.w_12').toggle(); }); $(document.body).on("mouseenter mouseleave", ".kg-13", function() { $('.w_13').toggle(); }); $(document.body).on("mouseenter mouseleave", ".kg-14", function() { $('.w_14').toggle(); }); $(document.body).on("mouseenter mouseleave", ".kg-15", function() { $('.w_15').toggle(); }); $(document.body).on("mouseenter mouseleave", ".kg-16", function() { $('.w_16').toggle(); }); $(document.body).on("mouseenter mouseleave", ".kg-17", function() { $('.w_17').toggle(); }); $(document.body).on("mouseenter mouseleave", ".kg-18", function() { $('.w_18').toggle(); }); $(document.body).on("mouseenter mouseleave", ".kg-19", function() { $('.w_19').toggle(); }); $(document.body).on("mouseenter mouseleave", ".kg-20", function() { $('.w_20').toggle(); }); $(document.body).on("mouseenter mouseleave", ".kg-21", function() { $('.w_21').toggle(); }); $(document.body).on("mouseenter mouseleave", ".kg-22", function() { $('.w_22').toggle(); }); }); </script>
Thats the error I get when I am not logged in:
Uncaught ReferenceError: jQuery is not defined at (index):61
Do you have any tips?
Thanks in advance!!!
July 11, 2019 at 3:51 am #954727DavidStaffCustomer SupportHi there,
try moving your script to the
WP_footer
hook as your site currently calls jQuery in the footer.July 11, 2019 at 4:00 am #954734AntonioHi David,
Unfortunately is not working.
I already tried and this is the error I get:
Uncaught ReferenceError: jQuery is not defined at (index):2038
I really can’t explain why.
July 11, 2019 at 4:36 am #954752DavidStaffCustomer SupportIssue: jQuery is being called near to the very bottom of the wp_footer so the script needs to come after that. You can do this by increasing the Hook Priority – try 25 or higher.
July 11, 2019 at 4:38 am #954759AntonioHi David,
Wow that’s great. Now is working properly.
Thanks a lot for you support.
You guys are awesome!
July 11, 2019 at 4:40 am #954762DavidStaffCustomer SupportYou’re welcome.
January 13, 2020 at 11:15 am #1130905MuhammadI was facing the same problem. Thank you Antonio for asking this question and thank you David for the rescue ๐
January 13, 2020 at 11:44 am #1130936DavidStaffCustomer SupportGlad we could be of help ๐
-
AuthorPosts
- You must be logged in to reply to this topic.