Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • 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. General Discussion
  3. Site-specific Javascript

Site-specific Javascript

Scheduled Pinned Locked Moved General Discussion
15 Posts 4 Posters 458 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.
  • L Offline
    L Offline
    lars
    wrote on last edited by
    #5

    Dear @mariusjopen

    I added the script in the custom head section.

    When I visit the project site by entering the URL or coming from the WP backend I get the console log.

    However if I set a link to this project on another page of my website and click on it, the log is not showing up.

    It seems as if the site needs to be reloaded entirely before the script fires.

    1 Reply Last reply
    0
    • RichardR Offline
      RichardR Offline
      Richard
      Global Moderator
      wrote on last edited by
      #6

      Dear @lars

      Thank you for your patience, forgive me for the late reply

      I will forward this To Armin so we can take a better look

      Thank you for using Lay Theme

      Sincerely
      Rich

      1 Reply Last reply
      0
      • arminunruhA Online
        arminunruhA Online
        arminunruh
        Global Moderator
        wrote on last edited by arminunruh
        #7

        Ok lol
        I re-read ur text and I think there's probably nothing wrong with the detection of the correct page.
        However, of course u need to remove your functionality on the other pages so I think ur code/ur logic is wrong.

        U should do:

        <script>
        window.laytheme.on("newpageshown", function(layoutObj, type, obj){
        	if(type == "page" && obj.id == 86){
        	    jQuery('.mobile-title').addClass('scrolltotop');
        	}else{
                   jQuery('.mobile-title').removeClass('scrolltotop');
                }
        });
        </script>
        
        1 Reply Last reply
        0
        • L Offline
          L Offline
          lars
          wrote on last edited by
          #8

          Dear @arminunruh

          thanks that totally makes sense! I replaced the script on the site and it works.

          I checked it with the web inspector and the class .scrolltotop is getting added and removed accordingly.

          However the same behaviour as stated in the first post still exists.

          If you go to https://strategis.de/impressum/ directly, or reload the page, the logo links back to home. If you however go from the home page to the site (via the burger menu) the logo still acts as a scroll to top button.

          1 Reply Last reply
          0
          • L Offline
            L Offline
            lars
            wrote on last edited by
            #9

            Okay another observation:

            Today I added a new page „Kontakt“ and put it in the mobile menu like Impressum and Datenschutz beforehand.

            For whatever reason the script works as intended when going from the main page to the „Kontakt“ page through the burger menu and vice versa. On „kontakt“ the logo is linking back to the main page.

            Also see the difference in the transition between clicking on „Impressum“, „Datenschutz“ or „Kontakt“. The click on „Kontakt“ seems to trigger a reload whereas the other two just chance the displayed content.

            Any chance to replicate this behaviour to the other menu points?

            1 Reply Last reply
            0
            • RichardR Offline
              RichardR Offline
              Richard
              Global Moderator
              wrote on last edited by
              #10

              Dear @lars

              Checking in :)

              Did you find a solution to your problem or does the issue still persist!

              Best wishes and have a great day

              Sicnerely
              Richard

              1 Reply Last reply
              0
              • L Offline
                L Offline
                lars
                wrote on last edited by
                #11

                Dear @Richard-Keith

                thanks for checking in.
                Unfortunately I haven’t found a solution yet.

                Like I stated in my post 12 days ago about the „Kontakt“ the script works fine as long as the page is properly (re)loaded in the browser. But it is not working when a transition from one page to another is invoked.

                Any way to tell the Laytheme Single Page JavaScript application to not transition but instead to reload a new page?

                1 Reply Last reply
                0
                • RichardR Offline
                  RichardR Offline
                  Richard
                  Global Moderator
                  wrote on last edited by Richard
                  #12

                  Dear @lars

                  Apologies that you haven't found a solution,
                  I will forward this straight away so we can find one faster :)

                  In the meantime if you could please send your website address, /wp-admin/ username and password and a link to this topic to info@laytheme.com? to speed up the process.

                  Hope you have a wonderful day and thank you for being a part of the Community.

                  Best wishes
                  Richard

                  1 Reply Last reply
                  0
                  • arminunruhA Online
                    arminunruhA Online
                    arminunruh
                    Global Moderator
                    wrote on last edited by
                    #13

                    Any way to tell the Laytheme Single Page JavaScript application to not transition but instead to reload a new page?

                    Hey @lars apologies for not getting back to you earlier. My support coworker is new and just started out.
                    Yes you can make lay theme reload on every page load.
                    Go to Lay Options and at the bottom activate "Disable Ajax / Compatibility Mode"

                    1 Reply Last reply
                    0
                    • L Offline
                      L Offline
                      lars
                      wrote on last edited by
                      #14

                      Hey @arminunruh no problem!

                      Your suggestions finally did the trick.
                      The script is working as intended.

                      Thank you very much.

                      Best
                      Lars

                      1 Reply Last reply
                      0
                      • RichardR Offline
                        RichardR Offline
                        Richard
                        Global Moderator
                        wrote on last edited by
                        #15

                        Dear @lars

                        Thanks for Getting back and confirming your success,

                        Best Wishes & Thank you for using Lay Theme!
                        Richard

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        I also code custom websites or custom Lay features.
                        💿 Email me here: 💿
                        info@laytheme.com

                        Before you post:
                        1. When using a WordPress Cache plugin, disable it or clear your cache.
                        2. Update Lay Theme and all Lay Theme Addons
                        3. Disable all Plugins
                        4. 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:
                        1. Post a link to where the problem is
                        2. Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
                        3. If the problem is difficult to explain, post screenshots / link to a video to explain it
                        Online Users
                        arminunruhA
                        arminunruh
                        F
                        francesco
                        L
                        lurchifon
                        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