Follow here my solution for this problem using the circular countdown (just remove the “type circular” option on PHP hook to apply the solution to all type of counters:
PHP HOOK (functions.php)
add_action('cbfccountdown_after_display', function($attr, $index){
if($attr['type'] != 'circular') return;
if($index != 1) return;
wp_enqueue_script('countdown-after-finish', get_template_directory_uri() . '/js/countdown-after-finish.js', [], false, true);
}, 99, 2);
JS CODE (countdown-after-finish.js)
(() => {
let d = document;
let el = d.querySelector("#cbfc-circular-countdown1");
const observer = new MutationObserver(() => {
let finished = true;
el.querySelectorAll(".cbfc-circular-val").forEach(el => {
if(el.innerHTML != 0) finished = false;
});
if(!finished) return;
// do something here
});
observer.observe(el, {subtree: true, childList: true});
})();
-
This reply was modified 4 years, 11 months ago by
Leandro Berg.
-
This reply was modified 4 years, 11 months ago by
Leandro Berg.
-
This reply was modified 4 years, 11 months ago by
Leandro Berg.
-
This reply was modified 4 years, 11 months ago by
Leandro Berg.
Hi,
We will think about this. we know better way to this integration, like php hooks in wordpress it’s possible to implement js hooks which we implemented in few other plugin before. will try to add such in this plugin in next release.
Hey Sabuj hello,
okay, until you do release that feature, maybe people can use my simple solution to achieve that.
Best.