Expand and collapse text in a new topic page

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
5 years ago
Hi to everyone

I wonder if anyone can explain to us how to expand and collapse a plain text in a new Topic Page.

The next 25 may in Europe it will change the privacy law and I would like to write a plain understandable text for our customers with the expandable text.

I've tried something like that:

<html>
<head>
<style type="text/css">
.row { vertical-align: top; height:auto !important; }
.list {display:none; }
.show {display: none; }
.hide:target + .show {display: inline; }
.hide:target {display: none; }
.hide:target ~ .list {display:inline; }
@media print { .hide, .show { display: none; } }
</style>
</head>
<body>
<div class="row">
<a href="#hide1" class="hide" id="hide1">Expand</a>
<a href="#show1" class="show" id="show1">Collapse</a>
<div class="list">
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
</div>
</div>
</body>
</html>

But does't work at all.
Can anyone help us?

Thank you
Lorenzo
5 years ago
if you could write a small javascript that could do the job. I can show your the code if you want...
5 years ago
btw, where is a new topic page/?
5 years ago
Yeah thank you if you can show me.


You can find it in the admin section, content management, there you will see the topic pages

Lorenzo
5 years ago
try this:


<!DOCTYPE html>

<html>
<head>
<style type="text/css"></style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $( "#clickme" ).click(function() {
    $( "#list" ).toggle( "slow", function() {
      // Animation complete.
    });
  });
});
</script>
</head>
<body>
<div class="row">
<a href="#hide1" class="hide" id="clickme">Toggle</a>
<div class="list" id="list">
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
</div>
</div>
</body>
</html>
5 years ago
Cool

It is working, thank you Justin

Is there a way to start with the text Item 1, Item 2 and Item 3 hidden and it appers when I click on Toggle?
5 years ago
Yes of course, you could add a div wrapped text2 and text3 and then toggle that div.
5 years ago
Thank you

Can you write me an example please? I'm not very "confident" with the codes :(

Thank you in advance
Lorenzo
5 years ago
<html>
<head>
<style type="text/css"></style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $( "#clickme" ).click(function() {
    $( "#list2" ).toggle( "slow", function() {
      // Animation complete.
    });
  });
});
</script>
</head>
<body>
<div class="row">
<a href="#hide1" class="hide" id="clickme">Toggle</a>
<div class="list" id="list">
<ul>
<li>Item 1</li>
<div  id="list2">
<li>Item 2</li>
<li>Item 3</li>
</div>
</ul>
</div>
</div>
</body>
</html>
5 years ago
Thank you Justin

But I meant something else, like the follow sentence:

The menù starts just with the word:

"Toggle"

and everything else is collapsed and only when I click on the word Toggle it appears like that:

Toggle
Item 1
Item 2
Item 3

I don't know if it is possible :-)
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.