javascript - Is it possible to use animate with an attribute with jQuery? -


i want change opacity of element jquery (with fade in animation):

$(`#pano-${index}`).animate({ 'opacity': 1}) 

but don't result want:

<a-sky style="opacity: 1;"></a-sky> 

i want accomplish this:

<a-sky opacity: 1></a-sky> 

is possible jquery?

note: works ... doesn't have animation: $(#pano-${index}).attr('opacity', 1)

as starter ten, timer loop...

var opacity = 0, // starting opacity     step = 0.1, // step size     target = 1, // target value     time = 50; // delay in milliseconds // start timer loop, , record it's index var interval = setinterval(function(){     // assuming selector works, set opacity     $(`#pano-${index}`).attr({opacity: opacity});     // increment opacity step size     opacity += step;     // if reached our target value, stop timer     if(opacity >= target){         clearinterval(interval);     } }, time); 

Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -