Key to technical implementation: the display feature of CSS is used. The value of the display feature is none and block. None is hidden, and block is displayed.
Previous design: The foldable area is divided into two areas: the title bar and content area. The title bar is always visible, and the content part can be folded or expanded. On the page, you can use two <div> elements to implement this design.
Steps:
Insert the <div> element into the page and add the JS Code to implement the folding function. The Code is as follows:
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ptml xmlns = "http://www.w3.org/1999/xhtml"> <pead> <title> </title> </pead> <body> Click Here This is some content to show and hide. <p> </p> Click Here This is some content to show and hide. </body> </ptml>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
The code implementation result is as follows: