使用我的代码,每次出现文本文件(..recent_donator.txt或..recent_follower.txt)的更改时,我都要为类".donator"
和".follower"
设置动画。我的代码部分正常工作,但只能使用jQuery动画fadeIn
或fadeOut
,任何时候我想做任何其他事情或设置自定义动画.animate()
没有任何反应。如何添加其他动画而不仅仅是“淡化”?
HTML:
<div class="donator animated slideInUp"><div class="unskew" id="donatorid"></div>
</div>
<div class="follower animated slideInUp"><div class="unskew" id="followerid"></div>
</div>
CSS:
.follower {
height: 300px;
width: 300px;
position: absolute;
font-size: 40px;
text-align: left;
padding-left: 180px;
-webkit-text-fill-color: #FFF;
}
.donator {
height: 300px;
width: 300px;
position: absolute;
font-size: 40px;
text-align: left;
padding-left: 580px;
-webkit-text-fill-color: #FFF;
}
JS:
var oldFollow, oldDonate;
var auto_refresh = setInterval(function() {
oldFollow = $('#followerid').html();
$('#followerid').load("../Muxy/most_recent_follower.txt");
oldDonate = $('#donatorid').html();
$('#donatorid').load("../Muxy/most_recent_donator.txt");
// console.log(oldFollow);
// console.log($('#followerid').html());
}, 1000);
var auto_check = setInterval(function() {
if ($('#followerid').html() != oldFollow) {
// actions (animations, div changes etc.)
$('.follower').fadeOut(500, function() {
$('.follower').fadeIn(500);
});
}
if ($('#donatorid').html() != oldDonate) {
// actions (animations, div changes etc.)
$('.donator').fadeOut(500, function() {
$('.donator').fadeIn(500);
});
}
}, 200);