Created
June 27, 2016 09:44
-
-
Save nahakyuu/bfb046ee083045cf98873a662d14141c to your computer and use it in GitHub Desktop.
显示全部
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="zh-hans"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
<style> | |
#main { | |
border: 1px solid #000; | |
width: 200px; | |
} | |
.show::after { | |
content: "显示全部"; | |
font-weight: bold; | |
} | |
.hide::after { | |
content: "隐藏"; | |
font-weight: bold; | |
} | |
.show > .body { | |
line-height: 1.4em; | |
height: 7em; | |
overflow: hidden; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="show" id="main"> | |
<div class="body"> | |
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Culpa sed nobis recusandae officia error alias iste nisi eveniet, | |
molestias quo beatae amet totam quibusdam delectus debitis voluptas nesciunt reiciendis eligendi. Fuga accusamus, | |
laborum id. | |
</div> | |
</div> | |
<script> | |
var main = document.getElementById('main'); | |
main.onclick = function () { | |
main.classList.toggle('show'); | |
main.classList.toggle('hide'); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://segmentfault.com/q/1010000005810634/a-1020000005812224