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

custom Switch button in footer

Scheduled Pinned Locked Moved General Discussion
20 Posts 2 Posters 3.3k Views 2 Watching
  • 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
    C
    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
      arminunruhA
      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
        C
        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
          C
          craigfeldspar
          wrote on last edited by
          #12

          hi
          up 🧌

          1 Reply Last reply
          0
          • arminunruhA
            arminunruhA
            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
              C
              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
                arminunruhA
                arminunruh
                Global Moderator
                wrote on last edited by
                #15

                im checking it out now

                1 Reply Last reply
                0
                • arminunruhA
                  arminunruhA
                  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
                    C
                    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
                      arminunruhA
                      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
                        arminunruhA
                        arminunruh
                        Global Moderator
                        wrote on 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
                          C
                          craigfeldspar
                          wrote on 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

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