Hi guys,
I'm running into an issue on Safari with a function I've created that uses the _next, and _prev properties on a tween object.
Here's the code:
const copy = new SplitText('.copy-' + i, {type:'chars, words', charsClass:'chars'})
tl.staggerTo(copy.chars, staggerDuration, {onStart: caretForward, onStartParams: ['{self}']}, staggerDuration, label)
function caretForward(tween) {
if (tween._prev) {
TweenMax.set(tween._prev.target, { borderRight: 'none' })
// this removes the caret for the previous character
// tween._prev is always null when called in Safari
}
TweenMax.set(tween.target, { autoAlpha: 1, borderRight: borderStyle })
// this adds the caret for the current character
if (tween._next === null) {
// tween._next is also always null when called in Safari
blink(tween.target)
}
}
I'm creating a typewriter effect whereby the caret is created (by adding a borderRight to the character) in the onStart callback, and subsequently removed using the _prev property in the following tween.
This works in every browser (including IE), however the _prev property seems to be always 'null' in Safari.
Does anyone have any ideas on what could be causing this?
Any help would be greatly appreciated!
Thanks,
Ryan