animation-fix
This commit is contained in:
@ -1,21 +1,31 @@
|
|||||||
|
var stage = 0
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
var height1 = $("#eins").height ();
|
var height1 = $("#eins").height ();
|
||||||
$(window).scroll(function () {
|
$(window).scroll(function () {
|
||||||
if (pos+600 >= height1){
|
var pos = $(this).scrollTop ();
|
||||||
$("#blobs").css ({
|
console.log (pos);
|
||||||
'top': '1000px',
|
if (pos+600 >= height1 && stage == 0){ moveBlobs (1000, 1000, 1)}
|
||||||
'right': '1000px',
|
else if (stage == 1 && pos < 400){ moveBlobs (0,0,0) }
|
||||||
/*'animation': 'move-down-1 5s'*/
|
|
||||||
})
|
})
|
||||||
$("blobs").animate ({'top': '1000px', 'right': '1000px'}, 5000)
|
|
||||||
} else {
|
|
||||||
$("#blobs").css ({
|
|
||||||
'top': '0px',
|
|
||||||
'right': '0px',
|
|
||||||
})
|
|
||||||
$("blobs").animate ({'top': '0px', 'right': '0px'}, 5000)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
function moveBlobs (t, r, to) {
|
||||||
|
var dur = 0.7
|
||||||
|
if (stage < to) {
|
||||||
|
$("#blobs").css ({
|
||||||
|
'animation': 'move-down-'+ to + ' ease-in-out '+dur+ 's'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$("#blobs").css ({
|
||||||
|
'animation': 'move-down-'+(to+1)+' ease-in-out '+dur+'s reverse'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
setTimeout (function () {$("#blobs").css ({
|
||||||
|
'top': t + 'px',
|
||||||
|
'right': r + 'px',
|
||||||
|
'animation': '0',});
|
||||||
|
stage = to;
|
||||||
|
}, (dur*1000)-1)
|
||||||
}
|
}
|
||||||
)
|
|
||||||
Reference in New Issue
Block a user