2016-04-08 49 views

回答

5

像這樣的東西應該工作:

$('.hello').addClass('hint-auto-fade');
.hello { 
 
    color: blue; 
 
} 
 

 
.hint-auto-fade { 
 
    animation: autoFade 5s linear; 
 
} 
 

 
@keyframes autoFade { 
 
    from { 
 
    background: #ffe; 
 
    color: #f00; 
 
    } 
 
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> 
 

 
<div class="hello"> 
 
    Hello 
 
</div> 
 

 
<hr> 
 

 
<p> 
 
Lorem ipsum dolor sit amet, consectetur adipiscing elit. <span class="hello">Phasellus consequat gravida arcu vulputate rutrum. Phasellus efficitur ante ac quam dapibus mollis.</span> Donec libero quam, sollicitudin in semper sed, interdum at nulla. 
 
</p>

+0

真棒!謝謝! –

+0

它必須是我的互聯網的延遲。在發表評論後,我立即投票並接受了您的答覆。現在完成了!再次感謝! –