Total Posts:
245
Karma:
1405
Joined:
12/29/2011
Location:
Italy
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
Total Posts:
39
Karma:
369
Joined:
3/26/2013
Location:
United States
if you could write a small javascript that could do the job. I can show your the code if you want...
Total Posts:
39
Karma:
369
Joined:
3/26/2013
Location:
United States
btw, where is a new topic page/?
Total Posts:
245
Karma:
1405
Joined:
12/29/2011
Location:
Italy
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
Total Posts:
39
Karma:
369
Joined:
3/26/2013
Location:
United States
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>
Total Posts:
245
Karma:
1405
Joined:
12/29/2011
Location:
Italy
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?
Total Posts:
39
Karma:
369
Joined:
3/26/2013
Location:
United States
Yes of course, you could add a div wrapped text2 and text3 and then toggle that div.
Total Posts:
245
Karma:
1405
Joined:
12/29/2011
Location:
Italy
Thank you Can you write me an example please? I'm not very "confident" with the codes :( Thank you in advance Lorenzo
Total Posts:
39
Karma:
369
Joined:
3/26/2013
Location:
United States
<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>
Total Posts:
245
Karma:
1405
Joined:
12/29/2011
Location:
Italy
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 :-)