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. custom Switch button in footer

custom Switch button in footer

Scheduled Pinned Locked Moved General Discussion
20 Posts 2 Posters 1.0k 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.
  • C Offline
    C Offline
    craigfeldspar
    wrote on last edited by
    #9

    to answer your question from the ‘anchor conflict’ topic, no, unfortunately that didn't solve the problem, which I'm still trying to resolve. I've re-applied the code you gave me here above but same thing, it displays the correct Serie/Artworks switch button corresponding to the page's cat-id, but it doesn't display the content accordingly (as if Artworks had actually been clicked).

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

      ok. if you could create a page where you just have like 2 or 3 rows in there. and make the bug happen in this simpler case.
      then i can try and fix it. cause this example case is too complex.

      1 Reply Last reply
      0
      • C Offline
        C Offline
        craigfeldspar
        wrote on last edited by
        #11

        I've made a test page with the same footer operation, let me know if this is better for you: https://benoitlefeuvre.com/test/

        thanks!

        1 Reply Last reply
        0
        • C Offline
          C Offline
          craigfeldspar
          wrote on last edited by
          #12

          hi
          up 🧌

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

            hey oh yea i need to check this out sry

            1 Reply Last reply
            0
            • C Offline
              C Offline
              craigfeldspar
              wrote on last edited by
              #14

              in this case, the switch button should be on Artworks, as the page category is data-catid=“[3]” and should display the correct content as if Artworks had been clicked.

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

                im checking it out now

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

                  ok it seems like i had a really hard time to understand what the problem was :O
                  i misunderstood you

                  basically you just need to trigger a click on one of the buttons

                  u got two buttons:

                  .artworks-button

                  and

                  .overview-button

                  and as far as i understand this would be the way to do it:

                  when you go to a page where you want overview-button to be auto-activated:

                  window.laytheme.on('newpageshown', function(){
                  if(jQuery("body").hasClass("slug-home"){
                  jQuery(".overview-button").click();
                  }
                  })
                  

                  basically when you visit the homepage, this will click the overview button using javascript:

                  but maybe u need to remove this custom js u got here:
                  57135bbc-4b67-4d79-91f0-c29f364d651b-image.png

                  this could be in conflict with that click js
                  i think u just add "selected" class

                  maybe for styling, instead use the class "expand-link-clicked" cause thats the "active" class

                  so basically with newpageshown and checking the body class you can find out which page u just landed on.
                  and then either call

                  jQuery(".overview-button").click();
                  

                  or

                  jQuery(".artworks-button").click();
                  

                  if my previous code was checking the right pages (no idea), it could for example look like

                  window.laytheme.on('newpageshown', function(){
                  	if(jQuery('body').attr('data-catid') == '[3]'){
                  		jQuery(".artworks-button").click();
                  	} else if(jQuery('body').attr('data-catid') == '[1]'){
                  		jQuery(".overview-button").click();
                  	}
                  })
                  

                  but basically this was no lay theme bug, you just needed help with your custom code

                  1 Reply Last reply
                  0
                  • C Offline
                    C Offline
                    craigfeldspar
                    wrote on last edited by
                    #17

                    Thanks for your reply. You're right, it's probably not a Lay bug but rather that I need help with my code. I tested it, but unfortunately it doesn't work.

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

                      :/
                      can you tell me:
                      which page should have what button activated??

                      and can u gimme your /wp-admin/ login

                      can you send your website address, /wp-admin/ username and password and a link to this topic to info@laytheme.com?

                      1 Reply Last reply
                      0
                      • arminunruhA Offline
                        arminunruhA Offline
                        arminunruh
                        Global Moderator
                        wrote last edited by arminunruh
                        #19
                        <script>
                            window.laytheme.on('newpageshown', function(){
                                setTimeout(function(){
                                	if(jQuery('body').attr('data-catid') == '[3]'){
                                	    if( window.utility.isDesktopOrTabletSize ) {
                                    		jQuery("#footer .artworks-button").click().addClass("selected");
                                    		jQuery("#footer .overview-button").removeClass("selected");
                                	    } else {
                                	        jQuery("#footer-custom-phone-grid .artworks-button").click().addClass("selected");
                                	        jQuery("#footer-custom-phone-grid .overview-button").removeClass("selected");
                                	    }
                                	} else if(jQuery('body').attr('data-catid') == '[1]'){
                                	    if( window.utility.isDesktopOrTabletSize ) {
                                		    jQuery("#footer .overview-button").click().addClass("selected");
                                		    jQuery("#footer .artworks-button").removeClass("selected");
                                	    } else {
                                	        jQuery("#footer-custom-phone-grid .overview-button").click().addClass("selected");
                                	        jQuery("#footer-custom-phone-grid .artworks-button").removeClass("selected");
                                	    }
                                	}
                                }, 1000)
                            })
                        </script>
                        

                        seems like this code is what was needed

                        1 Reply Last reply
                        0
                        • C Offline
                          C Offline
                          craigfeldspar
                          wrote last edited by
                          #20

                          Thank you very much for your help and your time. That's exactly what I was looking for 🙏

                          1 Reply Last reply
                          1
                          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
                          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