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. Best way to create Dropdown/Accordion?

Best way to create Dropdown/Accordion?

Scheduled Pinned Locked Moved General Discussion
6 Posts 2 Posters 283 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.
  • A Offline
    A Offline
    aaronfeng
    wrote on last edited by aaronfeng
    #1

    Hi,

    I've been having trouble making these dropdown elements("Project Info" and "Project Type") work even though I read and tried numerous ways from the posts here in this forum. Is there a way anyone could help me figure this out?

    Thank you in advance!![alt text]
    Desktop - 27.png
    Desktop - 28.png

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

      i will code an accordion element for this one day

      ok here it goes

      in lay options → custom html & css in "custom <head> content" enter this:

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

      then in the gridder go +more → +html
      and enter this:

      <div class="accordion">
          <div class="accordion-title lay-textformat-parent"><span>Title</span> <span class="plus">+</span><span class="minus">-</span></div>
          <div class="accordion-content lay-textformat-parent">
              <p>At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt.</p>
              <p>Mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio.</p>
          </div>
      </div>
      
      1 Reply Last reply
      0
      • A Offline
        A Offline
        aaronfeng
        wrote on last edited by aaronfeng
        #3

        Thank you so much @arminunruh! If I want the accordion content to fade in/out or a slight delay, what should I add in jQuery?

        And if I want to make this aligned to the right with the image at all times, how can I achieve that?
        Screen Shot 2022-09-17 at 9.46.42 PM.png

        Thank you thank you thank you!!

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

          hey you can use a css transition

          and to align sth to the right probably a float right

          sry im so busy atm i dont have time to code this

          1 Reply Last reply
          1
          • A Offline
            A Offline
            aaronfeng
            wrote on last edited by aaronfeng
            #5

            Thank you @Armin-Unruh! I tried the css animation, it doesn't work for me. Could you help me out when you get a chance? really appreciate it! Thank you

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

              hey aaron

              super busy, if you like email me at info@laytheme.com and i can do this for some €€, maybe theres more custom coding u want for that website and yea

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


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