Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

issue with window.onload for show_counter

$
0
0

Replies: 0

When we configured Google Tag Manager, we found that the window.onload init script stopped working, as GTM also implements a listener here.

So, we modified the code starting on line 93 (show_counter.js) and used this pattern. Please incorporate or post feedback at your convenience.
`[93] window.onload = function() {
//add countup via eventlistener
window.addEventListener ?
window.addEventListener(“load”,add_count_listener(),false):
window.attachEvent && window.attachEvent(“onload”,add_count_listener());

function add_count_listener() {
wpcjs_get_counter();
wpcjs_check_visibility();
$( window ).on( ‘scroll’, wpcjs_check_visibility );


Viewing all articles
Browse latest Browse all 59525

Trending Articles