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. Accordion: disable content jumping

Accordion: disable content jumping

Scheduled Pinned Locked Moved General Discussion
11 Posts 3 Posters 1.0k 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.
  • D
    D
    dennisbern
    wrote on last edited by
    #1

    Hi all, I have an accordion on my site.

    When the page is opened on a desktop page, the content of the oppsite page jumps down the end of the gridder (for mobile this function is perfect). Can I use a CSS code so that this won`t happen?

    The page is built like this:
    Left side: a stack with "headline text" and below it the "accordion code". on the right side of the gridder a "text block":

    https://biografie.art/die-eigenen-grenzen-anerkennen-radikal-copy

    All the best, Dennis

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

      hello!

      you could try this Enter this css in "lay options" -> "custom css & html" -> "custom css for desktop":

      .accordion-content{
      position: absolute;
      }

      1 Reply Last reply
      0
      • D
        D
        dennisbern
        wrote on last edited by dennisbern
        #3

        Awesome. Works perfectly! Thanks a lot!

        A 1 Reply Last reply
        0
        • D dennisbern

          Awesome. Works perfectly! Thanks a lot!

          A
          A
          alasdair17
          Global Moderator
          wrote on last edited by
          #4

          @dennisbern hey, I really like the way you have setup an accordion, is this via a plugin or custom code? It works really smoothly.

          1 Reply Last reply
          0
          • D
            D
            dennisbern
            wrote on last edited by dennisbern
            #5

            This is a custom code. Which I actually found in this forum. I think it was a code from @arminunruh

            I put it in an edit html box:

            <div class="accordion">
            <div class="accordion-title _accordion_title">
            <span>Title</span>
            <span class="plus">+</span>
            <span class="minus">-</span>
            </div>
            <div class="accordion-content _accordeon_laufschrift">
            <p>TEXT
            </div>
            </div>

            1 Reply Last reply
            1
            • D
              D
              dennisbern
              wrote on last edited by dennisbern
              #6

              Hey a question about my code :)

              I have blue links (desktop version) in my accordion. where can I edit them so that they are black?

              Another thing: I want the links to open in a separate tab or window. How can I do that with the HTML code?

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

                Links need to have a target blank attribute for them to be opened in a new tab.

                target="_blank"

                <a href="…" target="_blank">asd</a>

                Blue links to black is just CSS.

                .accordion a{
                color: black!important;
                }

                D 1 Reply Last reply
                1
                • arminunruhA
                  arminunruhA
                  arminunruh
                  Global Moderator
                  wrote on last edited by
                  #8

                  Thanks for providing the code for @alasdair17 , but I think it's missing the JavaScript part.

                  D A 2 Replies Last reply
                  0
                  • arminunruhA arminunruh

                    Thanks for providing the code for @alasdair17 , but I think it's missing the JavaScript part.

                    D
                    D
                    dennisbern
                    wrote on last edited by
                    #9

                    @arminunruh True:

                    <script>
                    window.laytheme.on('newpageshown', function(){
                    jQuery(".accordion-title").on("click", function(){
                    jQuery(this.parentNode).toggleClass("active")
                    })
                    })
                    </script>
                    <style>
                    .accordion-title{
                    cursor: pointer;
                    }
                    .accordion .minus, .accordion .plus{
                    margin-left: 30px;
                    }
                    .accordion .minus{
                    display: none;
                    }
                    .accordion .accordion-content{
                    display: none;
                    margin-top: 20px;
                    }
                    .accordion.active .minus{
                    display: inline;
                    }
                    .accordion.active .plus{
                    display: none;
                    }
                    .accordion.active .accordion-content{
                    display: block;
                    }
                    .accordion-title{
                    display: inline-block;
                    }
                    </style>

                    1 Reply Last reply
                    1
                    • arminunruhA arminunruh

                      Links need to have a target blank attribute for them to be opened in a new tab.

                      target="_blank"

                      <a href="…" target="_blank">asd</a>

                      Blue links to black is just CSS.

                      .accordion a{
                      color: black!important;
                      }

                      D
                      D
                      dennisbern
                      wrote on last edited by
                      #10

                      @arminunruh Thanks a lot. Works also perfect!

                      1 Reply Last reply
                      1
                      • arminunruhA arminunruh

                        Thanks for providing the code for @alasdair17 , but I think it's missing the JavaScript part.

                        A
                        A
                        alasdair17
                        Global Moderator
                        wrote on last edited by
                        #11

                        @arminunruh @dennisbern cheers!

                        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