Hi everyone.
I’m trying to make text in Wix scroll horizontally. I’ve been following this video https://www.youtube. com/watch?v=zthGUCfNgq4 but Velo says that the name ‘windowSize’ cannot be found. Not sure what I’m doing wrong here as my code is exactly like hers. My console log doesn’t return the window size either which is where I first new there was a problem
import { timeline } from 'wix-animations';
import wixWindow from 'wix-window';
// Get width of browser window for breakpoints. Lets us know how much the text needs to scroll
function getWindowSize() {
return wixWindow.getBoundingRect()
.then((windowSize) => {
console.log('horizontal', windowSize.window.width);
console.log('vertical', windowSize.window.height);
return windowSize.window;
});
}
$w.onReady(function () {
// Scroll text
let scrollLtR = $w('#scrollLtR');
// let scrollRtL = $w('#scrollRtL');
// let scrollBtT = $w('#scrollBtT');
// let scrollTtB = $w('#scrollTtB');
// Timelines
let scrollingTextLtR = timeline({ repeat: -1 });
// let scrollingTextRtL = timeline({ repeat: -1 });
// let scrollingTextBtT = timeline({ repeat: -1 });
// let scrollingTextTtB = timeline({ repeat: -1 });
getWindowSize()
.then(windowSize) => {
scrollingTextLtR
.add(scrollLtR, {
duration: 10000,
x: windowSize.width,
easing: 'easeLinear',
});
scrollingTextLtR.play
};
});