Number Counter - Only first column is 'counting', other 2 stay at '0'

Hello, My number counter had been functioning perfectly until suddenly, only the first of my 3 columns count up, the other 2 stay at zero. I have 2 counters on my site and this is happening on both pages. The counters function properly in the elfsite editor. The issue does not appear to be a browser/OS issue. Curious if this is a global issue. Site was build in Wix & tested on Mac & PC in Chrome, Firefox and Safari. Any insige is appreciated. Thanks in advance.

1 Like

Hey there @Rehab_Industries :wave:

I’ve shared your request with dev team. I’ll get back to you once I receive a response from them :slightly_smiling_face:

1 Like

Hi Max,
The number counter is suddenly working again… thanks for the quick reply!

1 Like

Yes, our devs have fixed it :wink:

They’ve added this code to the Custom CSS field on the Style tab of your widget’s settings:

.global-styles,
html, body {
  height: 100%;
  overflow: hidden;
}

And this script was added to the Custom JS field on the Settings tab:

const listenerBlock = (selector, callback) => {
  const initialTargetNode = document.querySelector(selector);
  if (initialTargetNode) {
    return callback(initialTargetNode);
  }

  const mutationObserver = new MutationObserver((mutations, observer) => {
    mutations.forEach(({ addedNodes }) =>
      addedNodes.forEach((node) => {
        if (node.nodeType === Node.ELEMENT_NODE) {
          const targetNode = node.querySelector(selector);
          if (targetNode) {
            observer.disconnect();
            return callback(targetNode);
          }
        }
      })
    );
  });

  mutationObserver.observe(document.body, {
    childList: true,
    subtree: true
  });
};

listenerBlock('[class*="Counter__CounterComponent-sc"]', () => {
  window.dispatchEvent(new Event('scroll'));
});
1 Like