0

Hello everyone,

    $(".textF").animate({width: actualWidth + "px"}, durations[0]*1000);

Fast question. This works because I got it with jQuery. But I have a lot of spans with that class and if I do it this way doesn't work:

    var fElements=document.getElementsByClassName("textF");
    fElements[0].animate({width: actualWidth + "px"}, durations[0]*1000);

The error I get:

Uncaught DOMException: Failed to execute 'animate' on 'Element': Partial keyframes are not supported.

1 Answers1

4

jquery not working with native javaScript function .

Error?- animate() is defined by jquery not with native Javascript

Refer the animate() jquery documentation

$(fElements[0]).animate({width: actualWidth + "px"}, durations[0]*1000);

or

$(fElements).eq(0).animate({width: actualWidth + "px"}, durations[0]*1000);
prasanth
  • 22,145
  • 4
  • 29
  • 53