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 :/

-
-
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login