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. One button with multiple anchors in it

One button with multiple anchors in it

Scheduled Pinned Locked Moved General Discussion
4 Posts 2 Posters 475 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.
  • P
    P
    pavloradich
    wrote on last edited by pavloradich
    #1

    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
    0
    • arminunruhA
      arminunruhA
      arminunruh
      Global Moderator
      wrote on last edited by arminunruh
      #2

      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
      0
      • arminunruhA 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
        P
        pavloradich
        wrote on last edited by
        #3

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

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

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