The Star Rating control in the review form is initialised on page load with javascript. If you are displaying the review form in a modal that is initialised after the DOMContentLoaded page load event has been triggered, the the Star Rating control won’t be initialised.
To fix this, you will need to hook into the modal event that is triggered when the modal is displayed, and add this: new GLSR.Forms();.
You can see how this is done for Elementor Pro Popups here: https://github.com/pryley/site-reviews/blob/9d63b8329a9ca856860bad5095898b00ff10a7f0/compatibility.php#L173-L184
I have tried different things, but it doesn’t match.
I’m using Wppostpopup.
Do you know how to adapt this code to this plug-in?
-
This reply was modified 5 years, 4 months ago by
sousouch.
It doesn’t look like that plugin triggers any javascript event that you can hook into when a modal is opened/closed.
You could try adding a click event to the link that you click to open the modal, but this may not work if the content of the modal is loaded dynamically.
For example:
var modalLink = document.querySelector('.modal-link');
if (modalLink) {
modalLink.addEventListener('click', function (ev) {
setTimeout(function () { new GLSR.Form(); }, 2000); // triggered after a 2 second delay
});
}
You will need to contact the author of that plugin to ask how to trigger some custom javascript when the modal is opened.
-
This reply was modified 5 years, 4 months ago by
Gemini Labs.