Last active
July 26, 2019 02:27
-
-
Save hoksea/62e4cfbc2e99d3e42b36e8978c000604 to your computer and use it in GitHub Desktop.
jQuery-slideToggle
This file contains hidden or 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
W3SCHOOL: jQuery slideToggle() Method | |
https://www.w3schools.com/jquery/eff_slidetoggle.asp | |
StackOverflow: slideToggle the next element | |
https://stackoverflow.com/questions/15272381/slidetoggle-the-next-element |
This file contains hidden or 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
<!-- example. use class "hideslide" & "hidecontent"--> | |
<div class="hideslide" style="cursor: pointer;">點我展開/隱藏 (方法五) 例子1</div> | |
<div class="hidecontent" style="display:none;"> | |
哎呀被發現了啦 (つд⊂) | |
(方法五) 例子1 | |
</div> | |
<div class="hideslide" style="cursor: pointer;;">點我展開/隱藏 (方法五) 例子2</div> | |
<div class="hidecontent" style="display:none;"> | |
哎呀被發現了啦 (つд⊂) | |
(方法五) 例子2 | |
</div> |
This file contains hidden or 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
$(".hideslide").click(function(){ | |
$(this).next(".hidecontent").slideToggle(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment