我是jquery的初学者。当我点击一个按钮时,我想做一个简单的淡入淡出,但是从屏幕上方,例如。减去最高价值。但我得到的只是在页面中滑动,而不是从上面滑动。它只在我加载html时才有效。在那之后,不透明度是唯一有效的。这是示例代码:
function check()
{
# http://www.cyberciti.biz/tips/handling-filenames-with-spaces-in-bash.html
OLDIFS=$IFS
IFS=$'\n'
# Read all pom files into an array
# - Search for repositories
# - Exclude folders
fileArray=($(find . -type f -not -path "./folder1/*" -not -path "*/folder2/*" -not -path "./.repository/*" -name "pom.xml" \
| xargs grep -P "<module>" \
-H -n))
IFS=$OLDIFS
# get length of an array
numberOfFiles=${#fileArray[@]}
# read all filenames
for (( i=0; i<${numberOfFiles}; i++ ));
do
echo "ERROR:Found repository definitions (file:line:occurrence): ${fileArray[$i]}"
done
if [ "$numberOfFiles" != "0" ]; then
echo "SUMMARY:Found $numberOfFiles pom.xml file(s) containing repository definitions."
exit 1
fi
}
check
当我加载html 时, package com.mypackage.usercodeinpoms;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class ExternalFileReader {
public static void main(String[] args) throws FileNotFoundException {
//file instance to reference text file
File text = new File("/home/user/temp/foo.txt");
//Creating Scanner instance to read file
Scanner scnr = new Scanner(text);
//Reading each line of file using Scanner class
int lineNumber = 1;
while(scnr.hasNextLine()){
String line = scnr.nextLine();
System.out.println("line " + lineNumber + " :" + line);
lineNumber++;
}
}
}
中的
#Page {
opacity: 0;
width:70%;
min-height: 300px;
background:white;
text-align: center;
border-radius: 20px;
position:relative;
padding:20px;
margin:0 auto;
}
和document.ready()
函数
$("#Page").position().top=$("#Page").outerHeight()*-1;
$("#Page").animate({top:$(".row").outerHeight(),opacity:'1'},1500);
似乎只有.click
我的fadeindown才有效。有人知道原因吗?
N.B:我只在我的浏览器中尝试,而不是托管它,甚至不在localhost
答案 0 :(得分:0)
只需使用css:
#Page {
position: relative;
top: 0;
opacity: 1;
transition: all 0.3s ease-in;
-webkit-transition: all 0.3s ease-in;
}
.hidden-element {
position: relative;
top: -100px;
opacity: 0;
transition: all 0.3s ease-out;
-webkit-transition: all 0.3s ease-out;
}
然后JQuery隐藏元素:
$("#Page").addClass('hidden-element');
并表示:
$("#Page").removeClass('hidden-element');