Pricing table customization

Can we change the shape or the toggle in the pricing table?

1 Like

Hi @Mauro_Berno :wave:

Could you please share a link to the page where your widget is installed and specify the shape of the toggle you’d like to have? I’ll be happy to check if it’s feasible :slightly_smiling_face:

Hi Max,

here the link where it is installed:
https://www.egnpeernetwork.com/membership-my

i was looking do a different toggle shake like a button, please find the picture attached.
Screenshot 2024-02-19 at 08.44.17

1 Like

Thanks!

I’ve forwarded your request to our devs and they’ll try to customize the widget for you. I’ll keep you updated :slightly_smiling_face:

Thank you for waiting @Mauro_Berno

Please add this script right after the widget installation code:

<script>
const waitForElement = (selector, root = document) => new Promise(res => {
  let i = 0;

  const check = () => {
    const component = root.querySelector(selector);

    if (component) {
      res(component);
    } else if (i !== 50) {
      setTimeout(check, 100);
      i++;
    }
  };

  check();
});



waitForElement(".eapps-pricing-table-toggle-container").then(toggleContainer => {
  toggleContainer.firstChild.style.display = "none";
  
  const items = [...document.querySelectorAll(".eapps-pricing-table-toggle-item")];
  const handleChange = (e) => {
    items[+e.target.checked].click();
  }
  
  const switchContainer = document.createElement("label");
  switchContainer.id = "switch";
  
  const switchInput = document.createElement("input");
  switchInput.type = "checkbox";
  switchInput.addEventListener("change", handleChange);
  
  const switchSlider = document.createElement("span");
  switchSlider.id = "switch-slider";
  
  const styleElem = document.createElement("style");
  const [firstItem, secondItem] = items;
  styleElem.innerHTML = `.eapps-pricing-table-toggle-container:before {content: '${firstItem.textContent.replace(/\n/g, '')}';} .eapps-pricing-table-toggle-container:after {content: '${secondItem.textContent.replace(/\n/g, '')}';}`;
  toggleContainer.appendChild(styleElem);
  
  switchContainer.append(switchInput, switchSlider);
  toggleContainer.append(switchContainer);
});
</script>

And this code should be added to the Custom CSS field on the Appearance tab of your widget’s settings:

#switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

#switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

#switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  -webkit-transition: .4s;
  transition: .4s;
  border-radius: 34px;
}

#switch-slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  -webkit-transition: .4s;
  transition: .4s;
  border-radius: 50%;
}

input:checked + #switch-slider {
  background-color: #4fbfe6;
}

input:focus + #switch-slider {
  box-shadow: 0 0 1px #4fbfe6;
}

input:checked + #switch-slider:before {
  -webkit-transform: translateX(26px);
  -ms-transform: translateX(26px);
  transform: translateX(26px);
}

.eapps-pricing-table-toggle-container:before {
  display: flex;
  align-items: center;
  margin-right: 10px;
  max-width: 100px;
}

.eapps-pricing-table-toggle-container:after {
  display: flex;
  align-items: center;
  margin-left: 10px;
  max-width: 100px;
}

Check it out and let me know if it helped :slightly_smiling_face: