Object adoptChangeClasses

Written by AdOpt

Updated

To change the styles of component classes, you need to send the window.adoptChangeClasses object in the JavaScript script with the following format:

  window.adoptChangeClasses = {      styles: {        web: {},        mobile: {}      },      hasImportant: true,      theme: 'light'  }

In the code above you can see that there are 2 internal properties which are styles and hasImportant.

  • styles: This is the object where the CSS properties of the classes are inserted and are separated into 2 more levels, which are web and mobile. It is possible to customize them according to the responsiveness of the screen.

  • hasImportant: It is a property of the **boolean ** type which is responsible for allowing or not allowing the classes to be overwritten by global styles of the site, through the use of the CSS "! important" attribute. By default it has the value true, i.e., if the user decides to allow the global styles of his site to override or influence the tag's classes, he must set the value false in this property.


The tag has been separated into 4 main components which have their own specific classes:

  1. controller

  2. card

  3. preferenceCard

  4. categories

Below is the format of the complete object with all the existing class names for customization:

{
styles: {
web: {
controller: {
button: {},
},
card: {
container: {},
content: {},
textContainer: {},
titleRow: {},
whiteLabelLogo: {},
adoptLink: {},
textsRow: {},
textRowContent: {},
textRowLinks: {},
buttonsContainer: {},
rejectAllLink: {},
rejectAllButton: {},
preferencesButton: {},
acceptAllButton: {}
},
preferenceCard: {
panel: {},
title: {},
closePanel: {},
tagCategories: {},
cardFooter: {},
smallTextFooter: {},
buttonsContainer: {},
rejectButton: {},
acceptButton: {}
},
categories: {
category: {},
title: {},
icon: {},
description: {},
toogleShowTags: {},
tag: {},
tagTitleSection: {},
tagTitle: {},
tagCookieContainer: {},
tagCleanCacheLink: {}
}
},

mobile: {
controller: {
button: {},
},
card: {
container: {},
content: {},
textContainer: {},
titleRow: {},
whiteLabelLogo: {},
adoptLink: {},
textsRow: {},
textRowContent: {},
textRowLinks: {},
buttonsContainer: {},
rejectAllLink: {},
rejectAllButton: {},
preferencesButton: {},
acceptAllButton: {}
},
preferenceCard: {
panel: {},
title: {},
closePanel: {},
tagCategories: {},
cardFooter: {},
smallTextFooter: {},
buttonsContainer: {},
rejectButton: {},
acceptButton: {}
},
categories: {
category: {},
title: {},
icon: {},
description: {},
toogleShowTags: {},
tag: {},
tagTitleSection: {},
tagTitle: {},
tagCookieContainer: {},
tagCleanCacheLink: {}
}
}
}
}

CSS properties must be inserted in CamelCase format.
Here are some examples:

  • background-color should be backgroundColor

  • font-size should be fontSize

  • border-radius should be borderRadius and so on...

Personalization Examples

Here are some examples to help you explore the many possibilities offered by our tag. Below, we highlight use cases for the class API and its capabilities.

Customize buttons

Button customization is achieved by manipulating CSS attributes. This allows you to adjust the border radius, inner paddings, font size, colors, hover effects, and more.

Customize modal layout

Using CSS attributes, you can edit and enhance the layout of your modal. This includes adding scroll bars, modifying paddings, alignments, sizes, and colors, giving you flexible control over the visual presentation of your modal.

Recommended articles

AdOpt logoAdOpt logo

Address: 7345 W Sand Lake Road, Ste 210 Office 5898 Orlando, FL 32819

15 Rue du Général Campredon, 34000 Montpellier, France

207 Rue de Bercy, 75012 Paris, France

EIN: 86-3965064

Phone: +1 (407) 768-3792

AdOpt

Resources

Product

Certifications

Google CMP PartnerIAB Europe TCF Registered Vendor

© GO ADOPT, LLC since 2020 - Made by people who love🍪