我的飄花設置起始位置和transition的值和課程中的一樣了,為什么是橫著飛的呢?
// 運動的軌跡
? ? ? ? ? ? var startPositionLeft = Math.random() * visualWidth - 100,
? ? ? ? ? ? ? ? startOpacity ? ?= 1,
? ? ? ? ? ? ? ? endPositionTop ?= visualHeight - 40,
? ? ? ? ? ? ? ? endPositionLeft = startPositionLeft - 100 + Math.random() * 500,
? ? ? ? ? ? ? ? duration ? ? ? ?= visualHeight * 10 + Math.random() * 5000;
2016-12-16
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
2016-12-06
起點和終點的位置設置對了嗎?
//起點位置
$flake.css({
? ? ? ? ? ? ? ? left: startPositionLeft,
? ? ? ? ? ? ? ? opacity : randomStart
? ? ? ? ? ? });
//終點位置
$flake.transition({
? ? ? ? ? ? ? ? top: endPositionTop,
? ? ? ? ? ? ? ? left: endPositionLeft,
? ? ? ? ? ? ? ? opacity: 0.7
? ? ? ? ? ? }, duration, 'ease-out', function() {
? ? ? ? ? ? ? ? $(this).remove() //結束后刪除
? ? ? ? ? ? });