Dynamize Text

Once created driven by our AdServer, the texts will change based on established parameters (Geolocation, weather, date/time, cookies, retargeting…).

To dynamize texts you have 4 methods at your service :

setText

The setText function allows you to insert a text in an element.

ADventori.Display.setText(element, data);

This function needs two parameters:

  • element: The target HTML tag where the text will be inserted
  • data: The data that will be sent in this element

Example


adaptText

The adaptText function allows you to adapt the text size to its container.

ADventori.Display.adaptText(element, minFontSize);

This function needs two parameters:

  • element: The target HTML tag where the text will be inserted
  • minFontSize: The text’s minimum size

Example

The HTML tag targeted by this function must be a block element and have the following CSS properties: width, height, font-size, line-height.

To use the adaptText method, the container which uses this method can’t use the CSS property display:none (please use opacity:0;visibility:hidden;).


setAndAdaptText

The setAndAdaptText function allows you to combine the two previous functions.

ADventori.Display.setAndAdaptText(element, data, minFontSize);

This function needs three parameters:

  • element: The target HTML tag where the text will be inserted
  • data: The data that will be sent in this element
  • minFontSize: The text’s minimum size

Example

The HTML tag targeted by this function must be a block element and have the following CSS properties: width, height, font-size, line-height.

To use the setAndAdaptText method, the container which uses this method can’t use the CSS property display:none (please use opacity:0;visibility:hidden;).

You can also define the size of your container directly from the method setAndAdaptText:

ADventori.Display.setAndAdaptText(element, data, minFontSize, {width:XXX,height:XXX});


verticalAlign

The verticalAlign function allows you to vertically align the text in its container.

ADventori.Display.verticalAlign(element);

This function needs one parameter:

  • element: The target HTML tag where the text is contained

Example

The HTML tag targeted by this function must be a block element and have the following CSS properties: width, height, font-size, line-height.

To use the adaptText method, the container which uses this method can’t use the CSS property display:none (please use opacity:0;visibility:hidden;).