We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ec180fc commit a0694d5Copy full SHA for a0694d5
sophora-components/datawrapper-switcher.html
@@ -50,7 +50,22 @@
50
});
51
console.log('Module loaded, mounting Datawrapper Switcher immediately');
52
window.__mountDatawrapperSwitcher();
53
+
54
+ if (window.$) {
55
+ $(document).on('pjax:end', () => {
56
+ console.log('PJAX navigation detected (jQuery), remounting Datawrapper Switcher');
57
+ window.__mountDatawrapperSwitcher();
58
+ });
59
+ } else {
60
+ console.warn(
61
+ 'jQuery not found, PJAX support for Datawrapper Switcher will be unavailable'
62
+ );
63
+ }
64
}
65
</script>
66
+ <script>
67
+ console.log('Executing inline script to mount Datawrapper Switcher');
68
+ window.__mountDatawrapperSwitcher && window.__mountDatawrapperSwitcher();
69
+ </script>
70
</body>
71
</html>
0 commit comments