0
I’m new to programming, so I don’t know how to use a lot of technical terms. I have an html pagination file. When I arrive on Mobile, the words "Previous" and "next" break line and stay below each other. I would like to abbreviate them only to "Ant." and "Prod.", but only when reaching resolution with a width of 370px.
I don’t know how to handle this code that is in html (It was already ready), so I thought I would use Javascript to replace the String when it reaches this width.
HTML code:
<div class="paginate-links">
{% if paginate.params.pageCount > 1 %}
{% if paginate.hasPrev %}
{{ paginate.prev('< Anterior', {'class': 'page-prev page-link'}) }}
{% endif %}
{{ paginate.numbers({
'modulus': 4,
'separator': '',
'class': 'page-link',
'currentClass': 'page-current'
}) }}
{% if paginate.hasNext %}
{{ paginate.next('Próxima >', {'class': 'page-next page-link'}) }}
{% endif %}
{% endif %}
</div>
<script type="text/javascript" src="js/main.js"></script>
I tried to program something in Javascript, but I’m not getting:
resolutionMobile = function () {
var resolutionWidth = window.innerWidth;
var buttonPrev = document.getElementsByClassName('page-prev');
if (resolutionWidth <= 370) {
buttonPrev.replace ("< Anterior", "< Ant.");
}
};
Thanks for all your help.
Hello Thiago. Here we prefer questions also that can help other developers who are having problems similar to yours. Try to edit your question to make it more generic. Ex: how to replace the text of a link, depending on the resolution of the page.
– Daniel Santos