Last active
December 2, 2023 18:35
-
-
Save softiconic/147864cacc4f66762fef616770536d30 to your computer and use it in GitHub Desktop.
JavaScript code snippet for displaying More/Less functionality.
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
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> | |
<script type="text/javascript"> | |
var $ = jQuery; | |
$(document).ready(function(){ | |
$('.show-more').on('click', function(){ | |
event.preventDefault() | |
$(this).toggleClass('content-hide') | |
$(this).closest('.profile-card').find('.show-less, .details-area').toggleClass('content-hide') | |
}) | |
$('.show-less').on('click', function(){ | |
event.preventDefault() | |
$(this).toggleClass('content-hide') | |
$(this).closest('.profile-card').find('.show-more, .details-area').toggleClass('content-hide') | |
}) | |
}) | |
</script> | |
<style> | |
.content-hide{ | |
display: none; | |
} | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment