Text swap hover interaction inital state changes depending on

I got a question for the Webflow community. I have these hover interactions set up in Webflow natively, so that when you hover on a flavor button, the flavor header name changes. And when you click the button the flavor/can image changes along with the header. My question is in regards to the hover interaction, I would like for the header to go back to whatever flavor button is currently focused. So if the orange button is focused and when you hover over lime button it changes to lime header but when you hover off lime I would like that header to change back to orange or whatever current flavor is focused.


I made a loom video that might better explain it.

I’m sure there is some jQuery code that could fix this up.Cheers (edited)

Here is my public share link: LINK
(how to access public share link)

T.ricks coming through again with the code fix🙏

The issue was solved with some code, as this cannot be done natively in Webflow.

You would set the the attributes to reflect what you would like the heading to say and it’s color value

let link = $(".link");
let selectedColor;
let selectedText;

function setSelected() {
  selectedColor = link.filter(".active").attr("data-color");
  selectedText = link.filter(".active").attr("data-text");

function setHeading(color, text) {
  $(".heading").css("color", color);

link.on("click", function () {
  setHeading(selectedColor, selectedText);

link.on("mouseenter", function () {
  let hoverColor = $(this).attr("data-color");
  let hoverText = $(this).attr("data-text");
  setHeading(hoverColor, hoverText);

link.on("mouseleave", function () {
  setHeading(selectedColor, selectedText);

Hope you found this helpful