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