Accordion: disable content jumping
-
hello!
you could try this Enter this css in "lay options" -> "custom css & html" -> "custom css for desktop":
.accordion-content{
position: absolute;
} -
Awesome. Works perfectly! Thanks a lot!
-
Awesome. Works perfectly! Thanks a lot!
@dennisbern hey, I really like the way you have setup an accordion, is this via a plugin or custom code? It works really smoothly.
-
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> -
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?
-
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;
} -
Thanks for providing the code for @alasdair17 , but I think it's missing the JavaScript part.
-
Thanks for providing the code for @alasdair17 , but I think it's missing the JavaScript part.
@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> -
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;
}@arminunruh Thanks a lot. Works also perfect!
-
Thanks for providing the code for @alasdair17 , but I think it's missing the JavaScript part.
@arminunruh @dennisbern cheers!
I also code custom websites or custom Lay features.
šæ Email me here: šæ
info@laytheme.com
Before you post:
- When using a WordPress Cache plugin, disable it or clear your cache.
- Update Lay Theme and all Lay Theme Addons
- Disable all Plugins
- 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:
- Post a link to where the problem is
- Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
- If the problem is difficult to explain, post screenshots / link to a video to explain it