Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Lay Theme Forum

  1. Home
  2. Bug Reports
  3. javascript doesn't work on all sites

javascript doesn't work on all sites

Scheduled Pinned Locked Moved Bug Reports
7 Posts 2 Posters 366 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A
    A
    ananazfr
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • mariusjopenM
      mariusjopenM
      mariusjopen
      Global Moderator
      wrote on last edited by
      #2

      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

      www.mariusjopen.world

      1 Reply Last reply
      0
      • A
        A
        ananazfr
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • mariusjopenM
          mariusjopenM
          mariusjopen
          Global Moderator
          wrote on last edited by
          #4

          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

          www.mariusjopen.world

          1 Reply Last reply
          0
          • A
            A
            ananazfr
            wrote on last edited by
            #5

            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 :/
            screen.png

            1 Reply Last reply
            0
            • A
              A
              ananazfr
              wrote on last edited by
              #6

              fyi: I replaced jQuery with javascript, works fine so far.

              1 Reply Last reply
              0
              • mariusjopenM
                mariusjopenM
                mariusjopen
                Global Moderator
                wrote on last edited by
                #7

                Dear @ananazfr

                yes. That is always the good solution!
                :-D

                Best!

                Marius

                www.mariusjopen.world

                1 Reply Last reply
                0

                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
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                Online Users
                I
                itsbadjujuju
                Forgot your key, lost your files, need a previous Lay Theme or Addon version? Go to www.laykeymanager.com
                laytheme.com
                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Recent
                • Tags
                • Popular
                • Users
                • Search