我正在尝试向我网站上的某个网页添加一个脚本,这是一个转换效果,当div在视野中从下往上移动时。我成功地将完全相同的脚本添加到另一个页面并且它可以工作,但由于某种原因,它不能在另一个页面上工作。我更改了页面上的整个脚本,因此它与脚本正常工作的页面大致相同,但不幸的是它没有改变任何内容......
可以在此处找到包含操作脚本的页面(删除所有不相关的脚本):http://codepen.io/anon/pen/qRKgWY
这是脚本(应该是正确的):
public static int maxCommonArraySlice(List<Integer> inputSequence) {
if(inputSequence.size() < 2) return inputSequence.size(); // I'm doubting this line should be <= 2
List<Integer> twoInts = new LinkedList<>();
twoInts.add(inputSequence.get(0));
int start = 0;
int end = inputSequence.size();
int count = 0;
int max_length = 0;
while(start < end) {
if(twoInts.contains(inputSequence.get(start))) {
count++;
start++;
}
else if(twoInts.size() == 1) {
twoInts.add(inputSequence.get(start));
}
else { // twoInts.size() is 2
count = 0;
start--;
twoInts.set(0, inputSequence.get(start));
twoInts.set(1, inputSequence.get(start + 1));
}
if(count > max_length) {
max_length = count;
}
}
return max_length;
}
public static void main(String[] args) {
List<Integer> input = new LinkedList<Integer>(Arrays.asList(53,800,0,0,0,356,8988,1,1));
System.out.println(maxCommonArraySlice(input));
}
答案 0 :(得分:1)
如果代码笔上的演示符合您的预期,也许您需要检查css或查看是否遗漏了其他内容。我认为没有任何课程被定义为&#34;已经可见&#34;和#34;进来&#34;,乍看之下我也没有看到任何动画相关的CSS或JS。 JS所做的就是根据可见性为这些元素分配一个类名,没有任何定义它的行为。