Created
December 19, 2019 12:50
-
-
Save estruyf/77fd69500219cde27246992634b823e7 to your computer and use it in GitHub Desktop.
Focal data of header image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const layoutContent = data.LayoutWebpartsContent; | |
| const el = document.createElement('div'); | |
| el.innerHTML = layoutContent; | |
| const divElm = el.querySelectorAll("[data-sp-canvascontrol]"); | |
| if (divElm && divElm.length > 0) { | |
| const cntlData = divElm[0].getAttribute("data-sp-controldata"); | |
| if (cntlData) { | |
| const pCtrlData = JSON.parse(cntlData); | |
| if (pCtrlData && pCtrlData.properties) { | |
| const focalData = { | |
| translateX: pCtrlData.properties.translateX || null, | |
| translateY: pCtrlData.properties.translateY || null | |
| }; | |
| // Now you can add the focal data to your images | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment