Last active
November 13, 2020 10:01
-
-
Save jsakhil/90cae105b58a65014b8820d87d6e10d0 to your computer and use it in GitHub Desktop.
Simple View More/ View Less Toggle for Content
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
$('.toggle').on('click', function(e){ | |
e.preventDefault(); | |
// Do Something | |
$(this).text($(this).text() == 'View More' ? 'View Less' : 'View More'); | |
}) | |
## Add class to body based on the URL – jQuery | |
var urlPath = window.location.pathname; | |
urlPath.match(/\/(.*?)(\+|$)/)[1].toLowerCase(); | |
urlPath = urlPath.replace(/\//g, '-').slice(1); | |
urlPath = urlPath.replace(/\.[^/.]+$/, ""); | |
$(document.body).addClass(urlPath); | |
$('body:not([class])').addClass('home'); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment