ADAPT THE TEXT SIZE
If you want to insert dynamic text in your advertising, but this text may take, in some cases more space than the space reserved for it in its Div, you can use theadaptText
method.
The adaptText
method reduced the font size on a given element , “10” is the minimum accepted size.
The reduction factor optimizes the display and adjusts the font size according to the space for the text field.
In cases where the entire text does not fit in the slot reserved for it and its font size is 15px, then the method will reduced it to 10px.
If the text is still too long following the reduction, non-displayed characters will be summarized by “…”
Important: To properly adjust the text size in the dedicated area, specify the following css properties in your element in pixels :
font-size /
line-height / width / height
To adjust the text size of a div:
To adjust the text size of a div (class):
<div class="wording">
< Default text >
</div>
<script type="text/javascript"> ADventori.Display.adaptText(document.getElementsByClassName('wording'), 10); </script>
You want to dynamize and adapt your text directly ? The method setAndAdaptText is made for you :
Similary, you can apply this features to elements of a class :
<div class="wording">
< Default text>
</div>
<script type="text/javascript"> ADventori.Display.setAndAdaptText(document.getElementsByClassName('wording'),demo.wording, 10); </script>
Important : To use the adaptText method, the container which use 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(document.getElementById('ADventori_text1'),ADventori.data.wording, 10, {width:270,height:160});