側邊欄點擊後只留顯示按鈕,點選顯示按鈕返回之前狀態
html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>收缩2</title> <link rel="stylesheet" href="./sousuo.css"> <script src="./jquery-1.7.2.min.js"></script> <script src="./sousuo.js"></script> </head> <body> <p id="show-result"> <p id="btn-show">收缩</p> <p id="btn-hide">显示</p> <table id="table-area"> <tbody> <tr> <td>经贸北校区</td> <td> <ul> <li>电话:13315955589</li> <li>地址:地大南院综合楼20楼2017室</li> </ul> </td> </tr> <tr> <td>汇华学院、经济管理学院</td> <td> <ul> <li>电话:13315955589</li> <li>地址:新市南路税务学校对面一克商务2楼领航学习中心</li> </ul> </td> </tr> <tr> <td>铁道大学</td> <td> <ul> <li>电话:13315955589</li> <li>地址:新铁道大学家属院11号楼5单元201(居委会楼上)</li> </ul> </td> </tr> <tr> <td>四方学院(南校区)</td> <td> <ul> <li>电话:13315955589</li> <li>地址:坦克北星徽超市西侧领航学习中心</li> </ul> </td> </tr> </tbody> </table> </p> </body> </html>
css
* { margin: 0; padding: 0; /*font-family: "Microsoft YaHei";*/ } body{position: relative} ul{list-style: none} #show-result { overflow-x: hidden; overflow-y: auto; width: 440px; position: absolute; right: 20px; top: 150px; height: 490px; /*background-color: #7bbedf;*/ } #show-result table { position: absolute; overflow-y: auto; display: block; width: 390px; height: 100%; /* position: relative; */ background-color: yellowgreen; right: -20px; } table tr { position: relative; } table tr td { display: block; /* width: 100%; */ } table tr td:first-child { border-top: 1px solid #DEDEDE; color: #4890D7; /* background-color: #00D685; */ /* height: 30%; */ font-size: 20px; /* color: white; */ line-height: 40px; padding-left: 20px; } table tr td:last-child { /* font-size: 18px; */ padding-left: 20px; /* height: 70%; */ } #btn-show { position: absolute; width: 70px; height: 70px; background-color: darkgoldenrod; line-height: 70px; text-align: center; color: white; cursor: pointer; left: 0; } .hideArea{ display: none; } #btn-hide { width: 70px; height: 70px; background-color: red; position: absolute; cursor: pointer; left: -70px; line-height: 70px; text-align: center; }
jQuery
$(document).ready(function () { var showResult = $("#show-result"); $("#btn-show").click(function () { $("#table-area").animate({right: '-390px'},1000); $("#btn-show").animate({"left": "380px"},1000); $("#btn-hide").delay(500).animate({left: '0'}); showResult.animate({width: '90px',height:'70px'},1000); showResult.addClass('overHide'); }); $("#btn-hide").click(function () { $("#table-area").animate({right: '-20px'},1000); $("#btn-show").animate({"left": "0px"},1000); $("#btn-hide").animate({left: '-70px'}); showResult.animate({width: '440px',height:'490px'},1000); showResult.removeClass('overHide'); }); })
以上是css實作側欄動態顯示隱藏的案例的詳細內容。更多資訊請關注PHP中文網其他相關文章!
陳述
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

Goofonts是由開發人員和設計師丈夫簽名的附帶項目,它們都是版式的忠實擁護者。我們一直在標記Google

學習如何構建GraphQL API可能具有挑戰性。但是您可以學習如何在10分鐘內使用GraphQL API!碰巧的是,我得到了完美的

這裡是Yuanchuan的一些合法CSS騙局。有此CSS屬性偏移路徑。曾幾何時,它被稱為Motion-Path,然後被更名。我


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

AI Hentai Generator
免費產生 AI 無盡。

熱門文章
R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
3 週前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.最佳圖形設置
3 週前By尊渡假赌尊渡假赌尊渡假赌
刺客信條陰影:貝殼謎語解決方案
2 週前ByDDD
R.E.P.O.如果您聽不到任何人,如何修復音頻
3 週前By尊渡假赌尊渡假赌尊渡假赌
WWE 2K25:如何解鎖Myrise中的所有內容
4 週前By尊渡假赌尊渡假赌尊渡假赌

熱工具

禪工作室 13.0.1
強大的PHP整合開發環境

SublimeText3 Linux新版
SublimeText3 Linux最新版

DVWA
Damn Vulnerable Web App (DVWA) 是一個PHP/MySQL的Web應用程序,非常容易受到攻擊。它的主要目標是成為安全專業人員在合法環境中測試自己的技能和工具的輔助工具,幫助Web開發人員更好地理解保護網路應用程式的過程,並幫助教師/學生在課堂環境中教授/學習Web應用程式安全性。 DVWA的目標是透過簡單直接的介面練習一些最常見的Web漏洞,難度各不相同。請注意,該軟體中

記事本++7.3.1
好用且免費的程式碼編輯器

MantisBT
Mantis是一個易於部署的基於Web的缺陷追蹤工具,用於幫助產品缺陷追蹤。它需要PHP、MySQL和一個Web伺服器。請查看我們的演示和託管服務。