Thanks for your welcome Jonathan
Yes, I have to use getDisplayDocument() because Trivantis Lectora version>17 pushes this function. It's a way to get productions published correctly with or without the new option (using an iframe or not). It returns the good reference to "document".
Doing a codepen is difficult in this case... It's firmly tied up with Lectora. Allow me to precise my previous examples :
TweenMax.from(getDisplayDocument().querySelectorAll(".image"), 1, {autoAlpha:0, delay:0.3});
This instruction works in every contexts, as expected.
But my wish is to simplify my life and keep the good old syntax :
TweenMax.from(".image", 1, {autoAlpha:0, delay:0.3});
So I digged a little and found https://greensock.com/docs/TweenMax/static.selector. Yay !
My problem is that the following instruction changed nothing :
TweenMax.selector = getDisplayDocument().querySelectorAll;
And with further testing, I realised that defining TweenMax.selector never changed anything... TweenMax behaved as if I was not there. And I hate being ignored ... when coding !
Last news : I realised a simple test but couldn't post in Codepen because it's "under heavy load". I confirm I do not understand how Tweenmax.selector works...
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>TweenMax.selector</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="TweenMax.min.js"></script>
</head>
<body>
<img id="img1" src="img1.jpg" alt="Image1">
<img id="img2" src="img2.jpg" alt="Image2">
<img id="img3" src="img3.jpg" alt="Image3">
<script>
// Function to make my example look like Lectora's context
function getDisplayDocument() {
return document;
}
function jQuery(el) {
console.log("Selects with a pseudo jQuery");
return getDisplayDocument().querySelectorAll(el);
}
function anonymousSelector(el) {
console.log("Selects with an anonymous selector");
return getDisplayDocument().querySelectorAll(el);
}
// Try with an anonymous selector
TweenMax.selector = anonymousSelector;
TweenMax.to("img", 1, {autoAlpha:0, delay:0.3});
// The console reports "Selects with a pseudo jQuery" !!! It's not anonymousSelector which is called but jQuery.
// If I comment function jQuery, no output, the default selector is used
</script>
</body>
</html>
Thanks for your attention Have a nice day !
Edit : Codepen is back, I tried posting my above example but the Codepen's console sent nothing...