• When a user successfully submits the form it turns the opacity to 0 for age gate but everything else remains. The age-gate-restricted, age-gate-js, and age-restriction classes remain on the HTMl and body tags which prevents a user from scrolling down the page.

    Strangely, if I go into the inspector tool and turn the opacity back on and then click any button on Age Gate it immediately gets rid of the classes then and works as intended.

    This only happens when using the JS version of the plugin. Unfortunately I can’t switch it because the hosting provider for the client forces caching.

    • This topic was modified 5 years, 4 months ago by robhyrk.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter robhyrk

    (@robhyrk)

    It looks like it might be server related as it is not occurring on the staging site. It appears that once input is submitted admin-ajax.php loads in the network tab but nothing else does. It stops there. If I refresh the page everything else loads fine.

    Thread Starter robhyrk

    (@robhyrk)

    Actually nvm, that does not seem to be the problem. I can confirm that the css classes do not get removed when a user verifies their age which causes the issues I mentioned above.

    Thread Starter robhyrk

    (@robhyrk)

    So after hours of fiddling around with cache settings the issue was actually a bug in the code.

    If you have “Transitions” selected to anything other than none the code to remove all the css classes will not run.

    The following code block in public/js/age-gate-public.js needs to fixed

                                key: "hide",
                                value: function () {
                                    var e = this;
                                    age_gate_params.settings.transition
                                        ? (jQuery(".age-gate-wrapper").on("transitionend", function (t) {
                                              jQuery(window).scrollTop(0),
                                                  jQuery("body").removeClass("age-restriction"),
                                                  jQuery("html").removeClass("age-gate-restricted age-gate-js"),
                                                  jQuery("body").removeClass("age-gate--error"),
                                                  jQuery(".age-gate-wrapper").remove(),
                                                  
                                                  e.removeViewport();
                                          }),
                                          jQuery(".age-gate-wrapper").addClass("transition " + age_gate_params.settings.transition))
                                        : (jQuery(window).scrollTop(0),
                                          jQuery("body").removeClass("age-restriction"),
                                          jQuery("body").removeClass("age-gate--error"),
                                          jQuery("html").removeClass("age-gate-restricted age-gate-js"),
                                          jQuery(".age-gate-wrapper").remove(),
                                      
                                          this.removeViewport());
                                },

    When I output age_gate_params.settings.transition to the console it showed the transition correctly but it skipped all those lines of jQuery code.

    If anyone else is having this issue you may just need to disable Transitions in the Appearance settings.

    • This reply was modified 5 years, 4 months ago by robhyrk.
    • This reply was modified 5 years, 4 months ago by robhyrk.
    Plugin Author Phil

    (@philsbury)

    Hi @robhyrk,

    Thanks for this, but even more so your investigation 🙂

    During my v3 rewrite I had something similar. I’ll have dig and see if I can find the issue here and get a patch into v2.

    Thanks
    Phil

    Thread Starter robhyrk

    (@robhyrk)

    I was on a time crunch and couldn’t wait haha. Hopefully it helps out for a future release!

    Great plugin btw! Even the paid ones aren’t as good. Cheers!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘On click/submit doesn’t remove restriction classes’ is closed to new replies.