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

Accordion: disable content jumping

Scheduled Pinned Locked Moved General Discussion
11 Posts 3 Posters 46 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.
  • D Offline
    D Offline
    dennisbern
    wrote on Apr 3, 2025, 8:59 AM 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
    • A Offline
      A Offline
      arminunruh
      Global Moderator
      wrote 29 days ago 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 Offline
        D Offline
        dennisbern
        wrote 25 days ago last edited by dennisbern 25 days ago
        #3

        Awesome. Works perfectly! Thanks a lot!

        A 1 Reply Last reply 25 days ago
        0
        • D dennisbern
          25 days ago

          Awesome. Works perfectly! Thanks a lot!

          A Offline
          A Offline
          alasdair17
          wrote 25 days ago 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 Offline
            D Offline
            dennisbern
            wrote 25 days ago last edited by dennisbern 25 days ago
            #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 Offline
              D Offline
              dennisbern
              wrote 23 days ago last edited by dennisbern 23 days ago
              #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
              • A Offline
                A Offline
                arminunruh
                Global Moderator
                wrote 21 days ago 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 15 days ago
                1
                • A Offline
                  A Offline
                  arminunruh
                  Global Moderator
                  wrote 21 days ago 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 15 days ago
                  0
                  • A arminunruh
                    21 days ago

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

                    D Offline
                    D Offline
                    dennisbern
                    wrote 15 days ago 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
                    • A arminunruh
                      21 days ago

                      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 Offline
                      D Offline
                      dennisbern
                      wrote 15 days ago last edited by
                      #10

                      @arminunruh Thanks a lot. Works also perfect!

                      1 Reply Last reply
                      1
                      • A arminunruh
                        21 days ago

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

                        A Offline
                        A Offline
                        alasdair17
                        wrote 15 days ago last edited by
                        #11

                        @arminunruh @dennisbern cheers!

                        1 Reply Last reply
                        1
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes

                        8/11

                        Apr 18, 2025, 6:59 AM


                        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.
                        8 out of 11
                        • First post
                          8/11
                          Last post
                        0
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Search