Jump to content

GraceS1800

Member
  • Posts

    3
  • Joined

  • Last visited

Posts posted by GraceS1800

  1. Hi all,

    I'm struggling to make this function work and would appreciate any and all help.

    I'm creating a site for a client and utilizing SS's portfolio function. I made a custom layout via CSS for the individual portfolio pages, and would like the owner of the site to be able to easily toggle these css modifications on or off on a specific page without having to write any code. 

    At the top of the individual portfolio pages, I added a code block that looks like this:

    <div class="layout1"></div>

    Then, I wrote a jquery script (and have the jquery library referenced already in the sitewide footer injection) and it looks like this: 

    <script>
    $(document).ready(function() {
        if ($("div").hasClass(".layout1")) {
            $("body").addClass(".layout1mods");
        }
    </script>

    Essentially, if a page has a div with the class .layout1, I'd like the class .layout1mods to be added to the body of a page (thereby adding all of the other modifications that I've specified in the class .layout1mods.

    Please let me know if you have any ideas on how to make this work!

    Thank you.

     

     

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.