We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a7c774e commit 29c4caeCopy full SHA for 29c4cae
1 file changed
src/app/social/social.service.ts
@@ -63,7 +63,21 @@ export class SocialService {
63
script.type = 'text/javascript';
64
script.src = environment.addToAnyPlugin.scriptUrl;
65
script.async = true;
66
- this._document.body.appendChild(script);
+
67
+ // Wait for document to finish grow vertically so that script listener handles properly body height changes
68
+ let lastBodyHeight = 0;
69
+ const documentBody = this._document.body;
70
71
+ const bodyHeightInterval = setInterval(() => {
72
+ const currentBodyHeight = documentBody.getBoundingClientRect().height;
73
74
+ if (currentBodyHeight > lastBodyHeight) {
75
+ lastBodyHeight = currentBodyHeight;
76
+ } else {
77
+ this._document.head.appendChild(script);
78
+ clearInterval(bodyHeightInterval);
79
+ }
80
+ }, 200);
81
}
82
83
/**
0 commit comments