如果你想要在个人网站上使用jQuery来模拟一个仿杀毒软件自动检测的效果,你可以创建一个简单的动画和交互。下面是一个简单的例子,它使用了jQuery来模拟一个进度条和检测完成的提示。
HTML部分 (index.html):
html
开始检测
CSS部分 (styles.css):css
.scan-progress {
width: 100%;
height: 20px;
background-color: #e5e5e5;
border-radius: 10px;
margin-bottom: 20px;
}
.progress-bar {
height: 100%;
width: 0%;
background-color: #4CAF50;
border-radius: 10px;
text-align: center;
line-height: 20px;
color: white;
}
#startScan {
padding: 10px 20px;
font-size: 16px;
}
JavaScript部分 (script.js):
javascript
$(document).ready(function() {
$(‘#startScan’).click(function() {
var progressBar = $(‘.progress-bar’);
var progress = 0;
function incrementProgress() {
if (progress < 100) {
progress += 10;
progressBar.css('width', progress + '%');
progressBar.text(progress + '%');
setTimeout(incrementProgress, 1000);
} else {
progressBar.text('检测完成!');
setTimeout(function() {
progressBar.text('');
progress = 0;
progressBar.css('width', '0%');
}, 2000);
}
}
incrementProgress();
});
});
在这个例子中,当你点击“开始检测”按钮时,会触发一个函数来模拟检测过程。检测进度通过一个progress变量来跟踪,并且每秒增加10%,直到达到100%为止。当检测完成时,进度条上的文本会变为“检测完成!”,并且在2秒后清空,准备下一次检测。
你可以根据需要调整CSS样式和JavaScript逻辑来适应你的个人网站设计和功能需求。例如,你可以增加更多的动画效果、更复杂的进度条样式、或者改变检测完成后的提示信息等。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=9,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>jQuery仿杀毒软件自动检测代码</title>
<link rel="stylesheet" href="css/autoCheck.css">
</head>
<body>
<a class="btn" onClick="AutoCheck.run(checkConfig);">执行检测</a>
<script src="js/jquery.min.js"></script>
<script src="js/AutoCheck.js"></script>
<script src="js/autoCheckDemo.js"></script>
<div style="text-align:center;margin:-100px 0; font:normal 14px/24px 'MicroSoft YaHei';">
<p>适用浏览器:IE8、360、FireFox、Chrome、Safari、Opera、傲游、搜狗、世界之窗.</p>
<p>programb:<a href="http://down.admin5.com/" target="_blank">programb</a></p>
</div>
</body>
</html>
html, body {
margin: 0;
padding: 0;
height: 100%; }
.btn {
display: inline-block;
background: #6089fb;
padding: 10px 17px;
color: #fff;
border-radius: 5px;
cursor: pointer;
margin: 50px; }
.modal {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(238, 238, 238, 0.5);
display: table;
z-index: 100; }
.modal .modal-content {
font-family: 'Microsoft YaHei', sans-serif;
display: table-cell;
vertical-align: middle;
text-align: center; }
.modal .modal-content .check-box {
display: inline-block;
background: #fff;
border: 1px solid #e0e0e0;
box-shadow: 0 2px 15px #c4c4c4;
padding: 60px;
min-width: 400px;
box-sizing: border-box; }
.modal .modal-content .check-box .check-list {
list-style: none;
margin: 0;
padding: 0; }
.modal .modal-content .check-box .check-list li {
padding: 0 50px;
margin-bottom: 30px;
font-size: 14px;
line-height: 22px;
color: #999;
text-align: left; }
.modal .modal-content .check-box .check-list li .check-icon {
width: 22px;
height: 22px;
background: url("../images/unchecked.png") no-repeat center;
color: #fff;
display: block;
float: left;
margin-right: 23px;
text-align: center; }
.modal .modal-content .check-box .check-list li.checking {
color: #ff8c00; }
.modal .modal-content .check-box .check-list li.checking .check-icon {
background: url("../images/checking.png") no-repeat left center; }
.modal .modal-content .check-box .check-list li.checked {
color: #666; }
.modal .modal-content .check-box .check-list li.checked .check-icon {
background: url("../images/checked.png") no-repeat left center; }
.modal .modal-content .check-box .check-list li .check-text {
max-width: 300px;
white-space: normal;
overflow: hidden;
display: block;
word-break: break-all; }
.modal .modal-content .check-box .check-bottom {
padding-top: 12px; }
.modal .modal-content .check-box .check-bottom .check-btn {
display: inline-block;
width: 100%;
height: 36px;
line-height: 36px;
background: #e5e5e5;
font-size: 16px;
color: #aaa;
text-align: center;
border-radius: 5px;
cursor: not-allowed; }
.modal .modal-content .check-box .check-bottom .check-btn.active {
background: #6089fb;
color: #fff;
cursor: pointer; }