我正在尝试使用Spark 2.1.1运行此简单代码。
* {
box-sizing: border-box;
}
.wrapper {
max-width: 800px;
margin: 0 auto;
background: #fff;
}
.stage {
position: relative;
padding: 100px;
background: #fff;
-webkit-filter: contrast(50);
-moz-filter: contrast(50);
-ms-filter: contrast(50);
-o-filter: contrast(50);
filter: contrast(50);
border: 5px solid black;
}
.title {
color: #fff;
text-transform: uppercase;
font-family: Helvetica;
font-weight: 700;
font-size: 70px;
line-height: 82px;
}
.dot {
position: absolute;
z-index: -1;
width: 200px;
height: 200px;
background-color: #000;
border-radius:50%;
-moz-filter: blur(25%);
-ms-filter: blur(25%);
-o-filter: blur(25%);
-webkit-filter: blur(25px);
filter: blur(25px);
}
但是在尝试访问每一行内部的对象时收到以下错误:
$(document).ready(function(){
var dots = $('.dot').toArray();
for(var i=0; i < dots.length; i++){
var myDot = dots[i];
animateDiv(myDot);
}
});
function animateDiv(myClass){
var newPos = makeNewPosition();
var duration = Math.floor(Math.random() * 3000) + 2000;
$(myClass).animate({ left: newPos[0], top: newPos[1] }, duration, function(){
animateDiv(myClass);
});
};
function makeNewPosition(){
var w = $('.stage').width() - $('.dot').width();
var h = $('.stage').height() - $('.dot').height();
var xOffset = 0;
var yOffset = 100;
var newX = Math.floor(Math.random() * w + xOffset);
var newY = Math.floor(Math.random() * h + yOffset);
return [newX,newY];
};
答案 0 :(得分:0)
我在Spark 2.3.0上试用过,效果很好。