about.js
2 weeks ago
admin-notifications.js
2 weeks ago
builders-preview-handler.js
2 weeks ago
callout.js
2 weeks ago
cff-admin-scripts.js
2 weeks ago
divi-handler.min.js
2 weeks ago
extensions.js
2 weeks ago
oembeds.js
2 weeks ago
settings.js
2 weeks ago
smash-usage-session.js
2 weeks ago
support.js
2 weeks ago
vue.min.js
2 weeks ago
callout.js
35 lines
| 1 | const positionCalloutContainer = (leave = false) => { |
| 2 | const calloutCtn = window.document.querySelectorAll('.sb-callout-ctn[data-type="side-menu"]'); |
| 3 | if (calloutCtn[0]) { |
| 4 | const calloutCtnRect = calloutCtn[0].getBoundingClientRect(); |
| 5 | let calloutCtnRectY = calloutCtnRect.y, |
| 6 | positionY = calloutCtnRectY + calloutCtnRect.height >= window.innerHeight; |
| 7 | |
| 8 | |
| 9 | if (positionY && !leave) { |
| 10 | calloutCtn[0].style.marginTop = -1 * ((calloutCtnRectY + calloutCtnRect.height) - window.innerHeight) +"px" |
| 11 | } else { |
| 12 | calloutCtn[0].style.marginTop = "0px" |
| 13 | } |
| 14 | |
| 15 | } |
| 16 | } |
| 17 | window.onload = () => { |
| 18 | positionCalloutContainer() |
| 19 | window.addEventListener("resize", (event) => { |
| 20 | positionCalloutContainer() |
| 21 | }); |
| 22 | |
| 23 | if(document.getElementById("toplevel_page_sb-facebook-feed")) { |
| 24 | document.getElementById("toplevel_page_sb-facebook-feed").addEventListener("mouseenter", (event) => { |
| 25 | if (!document.body.classList.contains('index-php')) { |
| 26 | positionCalloutContainer() |
| 27 | } |
| 28 | }); |
| 29 | document.getElementById("toplevel_page_sb-facebook-feed").addEventListener("mouseleave", (event) => { |
| 30 | if (!document.body.classList.contains('index-php')) { |
| 31 | positionCalloutContainer(true) |
| 32 | } |
| 33 | }); |
| 34 | } |
| 35 | } |