Popup Close Function Fix

User
X

NEW

BUY ANY 2 SAVE £20

Why Face-to-Face, Dynamic Custom Fitting Matters

Optimise Performance:there are thousands of potential specification to maximise the performance of a golf club; don't guess which are right for you and miss out on increased distance and improved accuracy.
Optimise ball flight: if you're hitting it too low or too high, you're likely to be missing out on important distance.
Improve consistency: whether you're a Tour Player or a beginner golfer, everyone will shoot lower scores by being more consistent and it starts with your equipment being custom fit for your personal game.
Purchase with confidence: a custom fitting will give you the confidence to know that you've tested all of the options and you're now investing in equipment that is going to take your game to a new level.
GET CUSTOM FITTED FOR YOUR PING GOLF CLUBS EVERY TIME YOU BUY
I confirm that I have undergone a face-to-face, dynamic custom fitting.
I have not undergone a face-to-face, dynamic custom fitting and I confirm that I understand the disadvantages of purchasing PING golf clubs without a custom fitting.

what to do you think is the , when I'm clicking anywhere it sgetting closed , I want to close it when I click on close button !

Assistant
The issue is likely caused by JavaScript or CSS that's listening to *any click inside or outside the `.ping-popup`* and closing it automatically. To fix this, you need to:

### ✅ Ensure the popup **only closes** when the `.closeform` button is clicked.

### ✅ Steps:

1. **Remove any global click listener** that's closing the popup (or update it).
2. **Attach a click handler** only on `.closeform`.

### ✅ Example Fix (JavaScript)

Add this script **after your HTML**, or inside a “ tag:

<script>
  document.addEventListener('DOMContentLoaded', function () {
    const popup = document.querySelector('.ping-popup');
    const closeButtons = document.querySelectorAll('.closeform');

    // Close only when clicking on a button with class `closeform`
    closeButtons.forEach(btn => {
      btn.addEventListener('click', function () {
        popup.style.display = 'none';
      });
    });

    // Remove any global click handler that closes the popup
    // (If there is one like this:)
    /*
    document.addEventListener('click', function () {
      popup.style.display = 'none';
    });
    */
  });
</script>

### ✅ Bonus: If using jQuery

jQuery(document).ready(function ($) {
  $('.closeform').on('click', function () {
    $('.ping-popup').hide();
  });

  // Prevent accidental closing by global click (if present)
  // $(document).on('click', function () {
  //   $('.ping-popup').hide();
  // });
});

### ✅ Check Your Code For This Problem:
Look for **any of these types of code** in your JavaScript:

document.addEventListener('click', function () {
  popup.style.display = 'none'; // ← remove or restrict this!
});

Or jQuery version:

$(document).on('click', function () {
  $('.ping-popup').hide(); // ← remove this if it's causing auto close
});

Would you like me to help search for that part in your existing code? You can paste the JS block here and I’ll pinpoint it.

Leave a Comment

Your email address will not be published. Required fields are marked *