Im using SplitText to reveal some text on a page which is working fine, but it is causing the page layout to break. The text column is 45% on desktop view and 100% on tablet and mobile view. When SplitText is active it is causing the layout to stay at 45% when the browser is resized to tablet view. When I turn SplitText off the problem is resolved.
This is how the text should look (view in the page editor)
This is how it looks with SplitText active
This is my code (https://codepen.io/gwjr/pen/JjZwvGj)
jQuery(document).ready(function($) {
;(function(){
let chck_if_gsap_loaded = setInterval(function(){
const eleBuilder = document.querySelector('body').classList.contains("elementor-editor-active");
if(window.gsap && window.ScrollTrigger && !eleBuilder){
gsap.registerPlugin(ScrollTrigger);
gsap.registerPlugin(SplitText);
text_reveal();
clearInterval(chck_if_gsap_loaded);
}
}, 500);
function text_reveal(){
const splitLines = new SplitText(".split-me p", {
type: "lines",
linesClass: "scroll-reveal scroll-reveal++"
});
jQuery(".split-me .scroll-reveal").wrap('<div class="scroll-reveal-wrapper">');
gsap.utils.toArray(".scroll-reveal").forEach((el) => {
gsap.from(el, {
yPercent: 200,
duration: 1,
ease: "power4",
scrollTrigger: {
trigger: el,
start: "top 90%"
}
});
});
};
})();
});