javascript doesn't work on all sites
-
Hi,
Whenever I hover over a link I would like to exchange the background image via custom javascript. It works fine on the frontpage. Now I would like to do exactly the same on another static page, same look, same code, just different id-xxx selectors. When I navigate through the webpage, starting from the front page, the javascript code is getting executed on the front page, but not on the static page.
However, if I open a preview of that static page directly from within wordpress, then the javascript code is getting executed.Any hints why is that?
I tried both
window.laytheme.on("newpageshown", function(layoutObj, type, obj){ }); window.laytheme.on("newpage", function(layoutObj, type, obj){ });
Many thanks!
Anna -
Dear @ananazfr Can you post a link to our website?
Then we can have a look and inspect that.did you try to call a simple
alert("TEST");
?Best!
Marius
-
Hi Marius,
The alert is also only getting called as soon as I open the preview directly from the static page in wordpress, but not when I navigate to it (as described in my previous post) . Would be very grateful if you could have a look at it, maybe I am missing something totally obvious. The website is not supposed to be online at this point, will send you the login details.
Many thanks!
Anna -
Dear @ananazfr
I called the console 3 times and all 3 calls worked on your website. Have a look in the CUSTOM HTMl section on your website.Best!
Marius
-
Yes, the Javascript is called. Then there must be something with jQuery, A console.log is called whenever I mouseenter/mouseleave over this link. It gets called the first time (see screenshot), but when I navigate to a different site and go back it doesn't get called anymore. The body class id is the same.... I am kind of biting my fingers :/
-
Before you post:
- When using a WordPress Cache plugin, disable it or clear your cache.
- Update Lay Theme and all Lay Theme Addons
- Disable all Plugins
- Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"
This often solves issues you might run into
When you post:
- Post a link to where the problem is
- Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
- If the problem is difficult to explain, post screenshots / link to a video to explain it