首页 > 其他分享 >下拉折叠效果

下拉折叠效果

时间:2024-07-15 18:19:14浏览次数:4  
标签:shown clicked 效果 text button some hidden 折叠

<!DOCTYPE html> <html lang="en">
<head>     <meta charset="UTF-8">     <meta name="viewport" content="width=device-width, initial-scale=1.0">     <title>Document</title>     <style>         .collapse-content {             max-height: 0;             overflow: hidden;             transition: max-height 0.2s ease-out;         }     </style> </head>
<body>     <button class="collapse-button">Toggle Collapse</button>     <div class="collapse-content">         <p>This is some text that will be hidden or shown when the button is clicked.</p>         <p>This is some text that will be hidden or shown when the button is clicked.</p>         <p>This is some text that will be hidden or shown when the button is clicked.</p>         <p>This is some text that will be hidden or shown when the button is clicked.</p>         <p>This is some text that will be hidden or shown when the button is clicked.</p>         <p>This is some text that will be hidden or shown when the button is clicked.</p>         <p>This is some text that will be hidden or shown when the button is clicked.</p>         <p>This is some text that will be hidden or shown when the button is clicked.</p>     </div>     <script>         document.querySelector('.collapse-button').addEventListener('click', function () {             var content = document.querySelector('.collapse-content');             if (content.style.maxHeight) {                 // 当点击时,如果section是显示的,则隐藏它                 content.style.maxHeight = null;             } else {                 // 当点击时,如果section是隐藏的,则显示它                 content.style.maxHeight = content.scrollHeight + "px";             }         });     </script> </body>
</html>

标签:shown,clicked,效果,text,button,some,hidden,折叠
From: https://www.cnblogs.com/unique-yaobo/p/18303717

相关文章

  • 3D 模型在 Game 视图中呈现为 2D效果
    废话不多说,上教程。......
  • WPF 滚动轮播文字(走马灯效果)
     XAML调用示例:<pp:RunningTextGrid.Row="2"Grid.Column="1"Padding="126"Space="0"Speed="120"FontSize="12"Direction="LeftToRight"Background="#5D6B99"Foreground="#......
  • OpenCV——实现视频图像抖动的效果
    #Jitterimportcv2importnumpyasnp#视频路径和输出路径input_video_path=r'D:\desk\20240713_test\Ori_Videos\ori_videos\IR\ir_shake_20240713.mp4'output_video_path=r'D:\desk\20240713_test\Ori_Videos\enhance\IR\jitter\jitter_20.......
  • OpenCV——实现视频图像的来回摆动的效果
    #Swingimportcv2defrotate_img(image,angle):#Readingtheimage#dividingheightandwidthby2togetthecenteroftheimageheight,width=image.shape[:2]#getthecentercoordinatesoftheimagetocreatethe2Drotationmatr......
  • MinIO - 服务端签名直传(前端 + 后端 + 效果演示)
    目录开始服务端签名直传概述代码实现后端实现前端实现效果演示开始服务端签名直传概述传统的,我们有两种方式将图片上传到OSS:a)前端请求->后端服务器->OSS 好处:在服务端上传,更加安全.坏处:给服务器带来压力.b)直接写在前端js代码中好处:效率高,不用给服务......
  • 记录---实现抖音 “视频无限滑动“效果
    ......
  • 易优实现发布时间显示类似几小时前、几天前的效果
    在网页开发中,我们经常需要显示文章或动态的发布时间,为了增加用户体验,通常会将发布时间显示为几秒前、几分钟前、几小时前、几天前、几月前等形式,以便更直观地展示时间的流逝。本文将介绍如何实现这样的效果。首先,在\extend\function.php添加以下代码:// 发表时间几天前的写法fu......
  • 前端JS特效第32集:jQuery空间相册梦幻效果
    jQuery空间相册梦幻效果,先来看看效果:部分核心的代码如下(全部代码在文章末尾):<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"xml:lang="en......
  • Web开发 —— 放大镜效果(HTML、CSS、JavaScript)
    目录一、需求描述二、实现效果三、完整代码四、实现过程1、HTML页面结构2、CSS元素样式3、JavaScript动态控制(1)获取元素(2)控制大图和遮罩层的显隐性(3)遮罩层跟随鼠标移动(4)控制遮罩层移动范围(5)显示放大图一、需求描述前端实现放大镜效果;鼠标移入图片区域,显示遮......
  • c++参数包展开和折叠表达式
    template<typenameT>voidfun2(Tt){cout<<t<<endl;}//利用逗号表达式和初始化列表展开template<typename...Arg6>voidfun1(Arg6...args){intarr[]={(fun2(args),0)...};}template<typenameT>intfunc3Imp(T&&t......