Eventfinity Development Resource Center Dashboard Support Center

Contact Us

General: Adding unique classes for each page

Add this script as high in the header section of the web access domain.

//Unique classes for different pages
var path = window.location.pathname;
var rel = path.split("/")
var unique = rel[1] + rel[2];

This script grabs the current path and adds a class to the body based on the first two sections. For example, the page https://lmcannual.eventfinity.co/directories/40221 adds a class called "directories40221" to it's own body element. This allows you to easily make css rules or js functions that only occur on specific pages.