I have this liquid code:
<a href="{{ block.settings.button_link }}" class="btn--full">
<div class="flex-btn">
{{ block.settings.button_label }}
{% render 'icon-arrow-right' %}
</div>
</a>
And I need to change the button_label when I hover.
Is there any way to do it with only CSS? Or should I use data- attributes and jQuery?
2
Answers
I think I have a solution for you.
You need to add a data attribute containing the wanted ‘hover text’, as you suggested yourself. Heres how I did it:
Notice that I put the text into a
span
. This is important because we don’t want to interfere with theicon-arrow-right
.Next up we need the jQuery. Here how I implemented it:
Hopefully that helps. I can elaborate on anything if you need it, so let me know if you do.
This solution requires no jQuery / Javascript. Try this.