Lay Theme Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Search

    One button with multiple anchors in it

    General Discussion
    2
    4
    53
    Loading More Posts
    • 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.
    • P
      pavloradich last edited by pavloradich

      Hi Armin,

      Could you please advice me how to create a one button that moves you from anchor to anchor on one long page.

      Example:
      I have a fixed BUTTON, and I would like it to bring me down to every next project, every time I click on it.
      (1st click - Project 1, 2nd click - Project 2, 3rd click - Project 3 and so on.)

      Do you perhaps know how it can be custom coded?
      Check photo to better understand what I mean, thanks a lot!

      Pavlo

      IMG_5131-min.JPG

      1 Reply Last reply Reply Quote 0
      • arminunruh
        arminunruh Global Moderator last edited by arminunruh

        yes sure! nice drawing <3!!

        var ix = 0;
        jQuery('.mybutton').on('click', function(){
        
        if(ix == 2){
        jQuery('.mybutton').find('a').attr('href', '#mypr1');
        ix = 0;
        } else if (ix == 1){
        jQuery('.mybutton').find('a').attr('href', '#mypr2');
        ix = 2;
        } else if (ix == 0) {
        jQuery('.mybutton').find('a').attr('href', '#mypr3');
        ix = 1;
        }
        
        })
        

        maybe that works! i haven't tested the code but i hope you can understand the logic behind it and make it work if it doesn't work

        your button needs to have the class "mybutton"

        the rows or elements you want to scroll to need to have an id of "mypr1" or "mypr2" or "mypr3"

        P 1 Reply Last reply Reply Quote 0
        • P
          pavloradich @arminunruh last edited by

          @arminunruh hi, thanks! Just tried it and unfortunately it doesn’t work.

          1 Reply Last reply Reply Quote 0
          • arminunruh
            arminunruh Global Moderator last edited by

            we made it work via email

            the html he used wasn't correct and we had to wrap the code in a newpageshown event

            https://laytheme.com/documentation/custom-javascript.html#newpage-events

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Post a link to where the problem is if possible, please <3
            I don't answer or check forum DMs, please just post on the forum.
            Forgot your key, lost your files, need a previous Lay Theme or Addon version? Go to www.laykeymanager.com

            Before you post:

            Use the Search Feature. Maybe there is already a solution to your issue.

            1. Update Lay Theme and all Lay Theme Addons
            2. Disable all Plugins
            3. Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code ", click "Save Changes"
            4. When using a WordPress Cache plugin, disable it or clear your cache. Now see if your problem solved itself.
            Go here, see if your problem is listed here:
            Troubleshooting

            When you post:
            1. Post a link to where the problem is
            2. If the problem is difficult to explain, post screenshots / link to a video to explain it

            Thanks!

            Online Users

            H

            Recent Topics

            • H

              Vimeo embed with autoplay and loop is really slow...help!

            • B

              FILTER Categories showing all projects

            • A

              website not loading on iphone safari

            • Gridder hides content / thumbnail grid

            laytheme.com