慕粉13482341627
2016-11-01 17:46
// 运动的轨迹
var startPositionLeft = Math.random() * visualWidth - 100,
startOpacity = 1,
endPositionTop = visualHeight - 40,
endPositionLeft = startPositionLeft - 100 + Math.random() * 500,
duration = visualHeight * 10 + Math.random() * 5000;
return $('<div class="snowbox" />').css({ 'width':41, 'height':41, 'position':'absolute', 'top':0, 'backgroundSize':'cover', 'zIndex':10000, 'backgroundImage': 'url(images/snowflake/'+Url+')', }).addClass('snowRoll');
加top
起点和终点的位置设置对了吗?
//起点位置
$flake.css({
left: startPositionLeft,
opacity : randomStart
});
//终点位置
$flake.transition({
top: endPositionTop,
left: endPositionLeft,
opacity: 0.7
}, duration, 'ease-out', function() {
$(this).remove() //结束后删除
});
H5+JS+CSS3实现七夕言情
211523 学习 · 540 问题
相似问题