jQuery: anime.js to multiple same targets The Next CEO of Stack OverflowIs there an “exists” function for jQuery?Add table row in jQueryHow do I check if an element is hidden in jQuery?Setting “checked” for a checkbox with jQuery?How to check whether a checkbox is checked in jQuery?How can I select an element with multiple classes in jQuery?Disable/enable an input with jQuery?How can I refresh a page with jQuery?jQuery scroll to element“Thinking in AngularJS” if I have a jQuery background?

Oldie but Goldie

Mathematica command that allows it to read my intentions

Arrows in tikz Markov chain diagram overlap

Is there a rule of thumb for determining the amount one should accept for a settlement offer?

Avoiding the "not like other girls" trope?

Why was Sir Cadogan fired?

What does this strange code stamp on my passport mean?

How exploitable/balanced is this homebrew spell: Spell Permanency?

How did scripture get the name bible?

Is it possible to make a 9x9 table fit within the default margins?

Is it possible to create a QR code using text?

Find the majority element, which appears more than half the time

Can a PhD from a non-TU9 German university become a professor in a TU9 university?

"Eavesdropping" vs "Listen in on"

How dangerous is XSS

Upgrading From a 9 Speed Sora Derailleur?

Identify and count spells (Distinctive events within each group)

Do I need to write [sic] when including a quotation with a number less than 10 that isn't written out?

Is it OK to decorate a log book cover?

Can you teleport closer to a creature you are Frightened of?

How can I prove that a state of equilibrium is unstable?

How should I connect my cat5 cable to connectors having an orange-green line?

Another proof that dividing by 0 does not exist -- is it right?

Is it reasonable to ask other researchers to send me their previous grant applications?



jQuery: anime.js to multiple same targets



The Next CEO of Stack OverflowIs there an “exists” function for jQuery?Add table row in jQueryHow do I check if an element is hidden in jQuery?Setting “checked” for a checkbox with jQuery?How to check whether a checkbox is checked in jQuery?How can I select an element with multiple classes in jQuery?Disable/enable an input with jQuery?How can I refresh a page with jQuery?jQuery scroll to element“Thinking in AngularJS” if I have a jQuery background?










0















$(".ml3").spanLetters();

$('.ml3').on('inview', function(event, isInView) if (isInView)

var $this = $(this);

anime.timeline(loop: false).add(
targets: '.ml3 .letter',
opacity: [0,1],
easing: "easeInOutQuad",
duration: 550,
delay: function(el, i)
return 80 * (i+1)

);

);


How can I change this so that the animation only fires for the current element in view, not all .ml3 classes on the page? So it uses only 'this' element in view?










share|improve this question






















  • animejs.com/documentation looks like the targets needs to be a selector, and can't be the element itself. So if that's true, you could potentially find the index of the this in the $('.ml3') and then construct a selector using :nth-child(#) developer.mozilla.org/en-US/docs/Web/CSS/:nth-child

    – Taplar
    Mar 7 at 19:43















0















$(".ml3").spanLetters();

$('.ml3').on('inview', function(event, isInView) if (isInView)

var $this = $(this);

anime.timeline(loop: false).add(
targets: '.ml3 .letter',
opacity: [0,1],
easing: "easeInOutQuad",
duration: 550,
delay: function(el, i)
return 80 * (i+1)

);

);


How can I change this so that the animation only fires for the current element in view, not all .ml3 classes on the page? So it uses only 'this' element in view?










share|improve this question






















  • animejs.com/documentation looks like the targets needs to be a selector, and can't be the element itself. So if that's true, you could potentially find the index of the this in the $('.ml3') and then construct a selector using :nth-child(#) developer.mozilla.org/en-US/docs/Web/CSS/:nth-child

    – Taplar
    Mar 7 at 19:43













0












0








0








$(".ml3").spanLetters();

$('.ml3').on('inview', function(event, isInView) if (isInView)

var $this = $(this);

anime.timeline(loop: false).add(
targets: '.ml3 .letter',
opacity: [0,1],
easing: "easeInOutQuad",
duration: 550,
delay: function(el, i)
return 80 * (i+1)

);

);


How can I change this so that the animation only fires for the current element in view, not all .ml3 classes on the page? So it uses only 'this' element in view?










share|improve this question














$(".ml3").spanLetters();

$('.ml3').on('inview', function(event, isInView) if (isInView)

var $this = $(this);

anime.timeline(loop: false).add(
targets: '.ml3 .letter',
opacity: [0,1],
easing: "easeInOutQuad",
duration: 550,
delay: function(el, i)
return 80 * (i+1)

);

);


How can I change this so that the animation only fires for the current element in view, not all .ml3 classes on the page? So it uses only 'this' element in view?







jquery






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 7 at 19:34









niksosniksos

1391215




1391215












  • animejs.com/documentation looks like the targets needs to be a selector, and can't be the element itself. So if that's true, you could potentially find the index of the this in the $('.ml3') and then construct a selector using :nth-child(#) developer.mozilla.org/en-US/docs/Web/CSS/:nth-child

    – Taplar
    Mar 7 at 19:43

















  • animejs.com/documentation looks like the targets needs to be a selector, and can't be the element itself. So if that's true, you could potentially find the index of the this in the $('.ml3') and then construct a selector using :nth-child(#) developer.mozilla.org/en-US/docs/Web/CSS/:nth-child

    – Taplar
    Mar 7 at 19:43
















animejs.com/documentation looks like the targets needs to be a selector, and can't be the element itself. So if that's true, you could potentially find the index of the this in the $('.ml3') and then construct a selector using :nth-child(#) developer.mozilla.org/en-US/docs/Web/CSS/:nth-child

– Taplar
Mar 7 at 19:43





animejs.com/documentation looks like the targets needs to be a selector, and can't be the element itself. So if that's true, you could potentially find the index of the this in the $('.ml3') and then construct a selector using :nth-child(#) developer.mozilla.org/en-US/docs/Web/CSS/:nth-child

– Taplar
Mar 7 at 19:43












1 Answer
1






active

oldest

votes


















0














Try the following. The goal being to try to construct the selector that would target the specific element that the view happened upon.






var $allML3 = $('.ml3').on('inview', function(event, isInView) 
if (isInView)
var index = $allML3.index(event.target);
var specificTargetSelector = `.ml3:nth-child($index + 1) .letter`

anime.timeline(
loop: false
).add(
targets: specificTargetSelector,
opacity: [0, 1],
easing: "easeInOutQuad",
duration: 550,
delay: function(el, i)
return 80 * (i + 1)

);

);





The index + 1 is due to :nth-child() starting at 1 rather than 0.






share|improve this answer























  • Can't get this to work. Im trying to target parent elements but without any luck either here

    – niksos
    Mar 8 at 15:39











  • codepen.io/clientagency/pen/gEWQjp here's a pen

    – niksos
    Mar 8 at 15:48











  • @niksos your selector is h1 span, but there are no span elements in your h1s

    – Taplar
    Mar 8 at 17:26











  • spans come automatically from lettering js...

    – niksos
    Mar 11 at 21:00











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55051524%2fjquery-anime-js-to-multiple-same-targets%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Try the following. The goal being to try to construct the selector that would target the specific element that the view happened upon.






var $allML3 = $('.ml3').on('inview', function(event, isInView) 
if (isInView)
var index = $allML3.index(event.target);
var specificTargetSelector = `.ml3:nth-child($index + 1) .letter`

anime.timeline(
loop: false
).add(
targets: specificTargetSelector,
opacity: [0, 1],
easing: "easeInOutQuad",
duration: 550,
delay: function(el, i)
return 80 * (i + 1)

);

);





The index + 1 is due to :nth-child() starting at 1 rather than 0.






share|improve this answer























  • Can't get this to work. Im trying to target parent elements but without any luck either here

    – niksos
    Mar 8 at 15:39











  • codepen.io/clientagency/pen/gEWQjp here's a pen

    – niksos
    Mar 8 at 15:48











  • @niksos your selector is h1 span, but there are no span elements in your h1s

    – Taplar
    Mar 8 at 17:26











  • spans come automatically from lettering js...

    – niksos
    Mar 11 at 21:00















0














Try the following. The goal being to try to construct the selector that would target the specific element that the view happened upon.






var $allML3 = $('.ml3').on('inview', function(event, isInView) 
if (isInView)
var index = $allML3.index(event.target);
var specificTargetSelector = `.ml3:nth-child($index + 1) .letter`

anime.timeline(
loop: false
).add(
targets: specificTargetSelector,
opacity: [0, 1],
easing: "easeInOutQuad",
duration: 550,
delay: function(el, i)
return 80 * (i + 1)

);

);





The index + 1 is due to :nth-child() starting at 1 rather than 0.






share|improve this answer























  • Can't get this to work. Im trying to target parent elements but without any luck either here

    – niksos
    Mar 8 at 15:39











  • codepen.io/clientagency/pen/gEWQjp here's a pen

    – niksos
    Mar 8 at 15:48











  • @niksos your selector is h1 span, but there are no span elements in your h1s

    – Taplar
    Mar 8 at 17:26











  • spans come automatically from lettering js...

    – niksos
    Mar 11 at 21:00













0












0








0







Try the following. The goal being to try to construct the selector that would target the specific element that the view happened upon.






var $allML3 = $('.ml3').on('inview', function(event, isInView) 
if (isInView)
var index = $allML3.index(event.target);
var specificTargetSelector = `.ml3:nth-child($index + 1) .letter`

anime.timeline(
loop: false
).add(
targets: specificTargetSelector,
opacity: [0, 1],
easing: "easeInOutQuad",
duration: 550,
delay: function(el, i)
return 80 * (i + 1)

);

);





The index + 1 is due to :nth-child() starting at 1 rather than 0.






share|improve this answer













Try the following. The goal being to try to construct the selector that would target the specific element that the view happened upon.






var $allML3 = $('.ml3').on('inview', function(event, isInView) 
if (isInView)
var index = $allML3.index(event.target);
var specificTargetSelector = `.ml3:nth-child($index + 1) .letter`

anime.timeline(
loop: false
).add(
targets: specificTargetSelector,
opacity: [0, 1],
easing: "easeInOutQuad",
duration: 550,
delay: function(el, i)
return 80 * (i + 1)

);

);





The index + 1 is due to :nth-child() starting at 1 rather than 0.






var $allML3 = $('.ml3').on('inview', function(event, isInView) 
if (isInView)
var index = $allML3.index(event.target);
var specificTargetSelector = `.ml3:nth-child($index + 1) .letter`

anime.timeline(
loop: false
).add(
targets: specificTargetSelector,
opacity: [0, 1],
easing: "easeInOutQuad",
duration: 550,
delay: function(el, i)
return 80 * (i + 1)

);

);





var $allML3 = $('.ml3').on('inview', function(event, isInView) 
if (isInView)
var index = $allML3.index(event.target);
var specificTargetSelector = `.ml3:nth-child($index + 1) .letter`

anime.timeline(
loop: false
).add(
targets: specificTargetSelector,
opacity: [0, 1],
easing: "easeInOutQuad",
duration: 550,
delay: function(el, i)
return 80 * (i + 1)

);

);






share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 7 at 19:46









TaplarTaplar

17.9k21529




17.9k21529












  • Can't get this to work. Im trying to target parent elements but without any luck either here

    – niksos
    Mar 8 at 15:39











  • codepen.io/clientagency/pen/gEWQjp here's a pen

    – niksos
    Mar 8 at 15:48











  • @niksos your selector is h1 span, but there are no span elements in your h1s

    – Taplar
    Mar 8 at 17:26











  • spans come automatically from lettering js...

    – niksos
    Mar 11 at 21:00

















  • Can't get this to work. Im trying to target parent elements but without any luck either here

    – niksos
    Mar 8 at 15:39











  • codepen.io/clientagency/pen/gEWQjp here's a pen

    – niksos
    Mar 8 at 15:48











  • @niksos your selector is h1 span, but there are no span elements in your h1s

    – Taplar
    Mar 8 at 17:26











  • spans come automatically from lettering js...

    – niksos
    Mar 11 at 21:00
















Can't get this to work. Im trying to target parent elements but without any luck either here

– niksos
Mar 8 at 15:39





Can't get this to work. Im trying to target parent elements but without any luck either here

– niksos
Mar 8 at 15:39













codepen.io/clientagency/pen/gEWQjp here's a pen

– niksos
Mar 8 at 15:48





codepen.io/clientagency/pen/gEWQjp here's a pen

– niksos
Mar 8 at 15:48













@niksos your selector is h1 span, but there are no span elements in your h1s

– Taplar
Mar 8 at 17:26





@niksos your selector is h1 span, but there are no span elements in your h1s

– Taplar
Mar 8 at 17:26













spans come automatically from lettering js...

– niksos
Mar 11 at 21:00





spans come automatically from lettering js...

– niksos
Mar 11 at 21:00



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55051524%2fjquery-anime-js-to-multiple-same-targets%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved