# 清华大学图书馆座位管理系统
**Source**: https://seat.lib.tsinghua.edu.cn/home/web/index
**Parent**: https://seat.lib.tsinghua.edu.cn/home/web/f_second
中文
清华大学图书馆座位管理系统\
The library space reservation system
-
-
- [预约规则](javascript:void(0);)
- [登录](javascript:void(0);)
-
欢迎 [退出登录](javascript:void(0);)
清华大学图书馆座位管理系统\
The library space reservation system
-
-
- [预约规则](javascript:void(0);)
-
- [登录](javascript:;)
- 欢迎 [退出登录](javascript:;)
##
## 公告信息
## 最新预约
Copyright © 2019.Company name All rights reserved.
//语言设置
var language="";
if(language=="en")
$("#language").text("中文");
else
$("#language").text("English");
$("#language").click(function(){
if(window.location.href.indexOf("?")>0){
if(this.innerText=='English'){
if(window.location.href.indexOf("language")>0)
window.location.href = window.location.href.substring(0,window.location.href.indexOf("language"))+"&language=en";
else
window.location.href = window.location.href+"&language=en";
}
if(this.innerText=='中文'){
if(window.location.href.indexOf("language")>0)
window.location.href = window.location.href.substring(0,window.location.href.indexOf("language"))+"&language=zh";
else
window.location.href = window.location.href+"&language=zh";
}
}else{
if(this.innerText=='English')
window.location.href=window.location.pathname+"?language=en";
if(this.innerText=='中文')
window.location.href=window.location.pathname+"?language=zh";
}
});
function foot\_set(){
//底部固定
var content\_top = $(window).height();
var footer\_top = $('.foots').offset().top+15;
if (footer\_top < content\_top) {
$('.foots').css('position', 'absolute')
$('.foots').css('bottom', 0)
}
}
window.ska = {
'bookRule':"zh"=="en"?["<p>To make full use of the library seats for all the library users, please review the guidelines before reserving.<\/p>","<p>1\u3001Seats are for the use of current Tsinghua students, faculty, and staff.<\/p>","<p>2\u3001Go to seat.lib.tsinghua.edu.cn or WeChat official account\uff08\u6e05\u534e\u5927\u5b66\u56fe\u4e66\u9986\uff09for reservations. System OPENTIME\uff1a 6\uff1a00-23\uff1a00.<\/p>","<p>3\u3001Seats may be reserved 1 day in advance.<\/p>","<p>4\u3001Reservations must be checked in in 30 minutes after beginning.<\/p>","<p>5\u3001Swipe your ID at the card reader for 60 minutes temporary leave.<\/p>","<p>6\u3001Swipe your ID at the card reader or gate control system to release your seat.<\/p>","<p>7\u3001Seats are only available during library hours.<\/p>","<p>8\u3001If you will not use the seat reserved, please use \u2018cancel the reservation\u2019 (once a day).<\/p>","<p>9\u3001If your request violates any of these guidelines, it will be cancelled and make a violation record.<\/p>","<p>10\u3001If you have 5 violation records, you will be suspended for 3 days (natural day) to use the library seats. The records will be resetted every semester (March 1st and September 1st).<\/p>","<p>11\u3001The details of violation records can be checked in the \u201cmy center\u201d on the reservation webpage or WeChat.<\/p>","<p>Any comments or suggestions on the seat management system, please contact\uff1a<\/p>","<p>Main Library North Section (Mochtar Riady Library), Main Library West Section (Yifu Library)\uff1a 62788937, circdesk@tsinghua.edu.cn<\/p>","<p>Humanities and Social Sciences Library\uff1a 62798676, hs-ic@tsinghua.edu.cn<\/p>","<p>Law Library\uff1a 62772955, lawlib@tsinghua.edu.cn<\/p>","<p>Arts Library\uff1a 62798810, artslib@tsinghua.edu.cn<\/p>","<p>Finance Library\uff1a 62772511, libfinance@tsinghua.edu.cn<\/p>"]:["<p>1.\u8bfb\u8005\u767b\u5f55\u201c\u6e05\u534e\u5927\u5b66\u56fe\u4e66\u9986\u5ea7\u4f4d\u7ba1\u7406\u7cfb\u7edf\u201d\/\u201c\u6e05\u534e\u5927\u5b66\u56fe\u4e66\u9986\u201d\u5fae\u4fe1\u516c\u4f17\u53f7\uff0c\u53ef\u9884\u7ea6\u5f53\u65e5\u6216\u6b21\u65e5\u7684\u5ea7\u4f4d\u3002\u7cfb\u7edf\u5f00\u653e\u65f6\u95f4\u4e3a\u6bcf\u65e5\u76846\uff1a00-23\uff1a00\u3002<\/p>","<p>\u6ce8\uff1a\u6301\u56fe\u4e66\u9986\u53d1\u653e\u7684\u4e34\u65f6\u501f\u4e66\u8bc1\/\u9605\u89c8\u8bc1\u7684\u8bfb\u8005\u6682\u4e0d\u80fd\u5728\u7ebf\u9884\u7ea6\u5ea7\u4f4d\uff0c\u53ea\u80fd\u901a\u8fc7\u9009\u4f4d\u673a\u73b0\u573a\u9009\u5ea7\u3002<\/p>","<p>2.\u8bfb\u8005\u5728\u5f00\u9986\u65f6\u95f4\u6bb5\u9884\u7ea6\u5f53\u65e5\u5ea7\u4f4d\uff0c\u987b\u5728\u9884\u7ea6\u6210\u529f\u540e30\u5206\u949f\u5185\u5b8c\u6210\u7b7e\u5230\u3002<\/p>","<p>\uff081\uff09\u672a\u8fdb\u9986\u8bfb\u8005\u901a\u8fc7\u95e8\u7981\u95f8\u673a\u5237\u5361\u5165\u9986\u81ea\u52a8\u5b8c\u6210\u7b7e\u5230\uff1b<\/p>","<p>\uff082\uff09\u5df2\u5165\u9986\u8bfb\u8005\u81ea\u52a8\u7b7e\u5230\uff0c\u65e0\u9700\u5728\u9009\u4f4d\u673a\u4e0a\u5237\u5361\u7b7e\u5230\uff1b<\/p>","<p>\uff083\uff09\u5982\u672a\u53ca\u65f6\u7b7e\u5230\uff0c\u7cfb\u7edf\u5c06\u91ca\u653e\u5ea7\u4f4d\u5e76\u8bb0\u8fdd\u89c41\u6b21\u3002<\/p>","<p>3.\u8bfb\u8005\u5728\u672a\u5f00\u9986\u65f6\u95f4\u6bb5\u9884\u7ea6\u5ea7\u4f4d\uff08\u542b\u6b21\u65e5\uff09\uff0c\u987b\u5728\u9884\u7ea6\u751f\u6548\u65e5\u5f00\u9986\u540e30\u5206\u949f\u5185\u7b7e\u5230\u3002<\/p>","<p>\uff081\uff09\u5f00\u9986\u540e\u901a\u8fc7\u95e8\u7981\u95f8\u673a\u5237\u5361\u5165\u9986\u81ea\u52a8\u5b8c\u6210\u7b7e\u5230\uff1b<\/p>","<p>\uff082\uff09\u5982\u672a\u53ca\u65f6\u7b7e\u5230\uff0c\u7cfb\u7edf\u5c06\u91ca\u653e\u5ea7\u4f4d\u5e76\u8bb0\u8fdd\u89c41\u6b21\u3002<\/p>","<p>4.\u4e34\u65f6\u79bb\u5f00\u5ea7\u4f4d\uff1a<\/p>","<p>\uff081\uff09\u5728\u9009\u4f4d\u673a\u5237\u5361\u9009\u62e9\u201c\u4e34\u65f6\u79bb\u5f00\u201d\uff0c\u5ea7\u4f4d\u5c06\u4fdd\u755960\u5206\u949f\u3002(\u7f8e\u672f\u56fe\u4e66\u9986\u3001\u6cd5\u5f8b\u56fe\u4e66\u9986\u5c31\u9910\u65f6\u6bb5\uff0811\uff1a00-13\uff1a00,17\uff1a00-18\uff1a00\uff09\u5ef6\u957f\u81f390\u5206\u949f\uff09<\/p>","<p>\uff082\uff09\u5df2\u9009\u62e9\u201c\u4e34\u65f6\u79bb\u5f00\u201d\u7684\u8bfb\u8005\u5728\u4fdd\u7559\u65f6\u95f4\u5185\u8fd4\u56de\u56fe\u4e66\u9986\u65f6\uff0c\u4ece\u95e8\u7981\u95f8\u673a\u5165\u9986\u5373\u81ea\u52a8\u5b8c\u6210\u7b7e\u5230\uff0c\u6216\u81f3\u9009\u4f4d\u673a\u5b8c\u6210\u201c\u4e34\u65f6\u79bb\u5f00\u201d\u7b7e\u5230\u3002<\/p>","<p>\uff083\uff09\u5982\u672a\u6309\u65f6\u8fd4\u56de\uff0c\u7cfb\u7edf\u5c06\u91ca\u653e\u5ea7\u4f4d\u5e76\u8bb0\u8fdd\u89c41\u6b21\u3002<\/p>","<p>5.\u8bfb\u8005\u5728\u9009\u4f4d\u673a\u5237\u5361\u5e76\u70b9\u51fb\u201c\u5b8c\u5168\u79bb\u5f00\u201d\uff0c\u6216\u51fa\u9986\u95e8\u7981\u5237\u5361\u540e\uff0c\u5ea7\u4f4d\u5c06\u91ca\u653e\uff0c\u7ed3\u675f\u4f7f\u7528\u72b6\u6001\u3002<\/p>","<p>6.\u5982\u65e0\u6cd5\u6b63\u5e38\u8d74\u7ea6\uff0c\u5e94\u5728\u9884\u7ea6\u5f00\u59cb\u524d\uff08\u6216\u9884\u7ea6\u5f00\u59cb\u540e30\u5206\u949f\u5185\uff09\u767b\u5f55\u5ea7\u4f4d\u7ba1\u7406\u7cfb\u7edf\u4f7f\u7528\u201c\u53d6\u6d88\u9884\u7ea6\u201d\u529f\u80fd\uff0c\u8be5\u529f\u80fd\u4f7f\u7528\u9650\u6bcf\u65e51\u6b21\u3002<\/p>","<p>7.\u8bfb\u8005\u5728\u5404\u9986\u4f7f\u7528\u5ea7\u4f4d\u671f\u95f4\u53d1\u751f\u7684\u5404\u7c7b\u578b\u8fdd\u89c4\u8bb0\u5f55\uff0c\u5c06\u7edf\u4e00\u7d2f\u8ba1\u3002\u8fdd\u89c4\u8ba1\u6b21\u6ee15\u6b21\uff0c\u6682\u505c3\u5929\uff08\u81ea\u7136\u65e5\uff09\u5ea7\u4f4d\u4f7f\u7528\u6743\uff08\u542b\u9884\u7ea6\uff09\u3002\u505c\u7528\u671f\u7ed3\u675f\u540e\uff0c\u8fdd\u89c4\u8ba1\u6b21\u5f52\u96f6\uff0c\u6062\u590d\u9009\u4f4d\u548c\u9884\u7ea6\u6743\u9650\u3002<\/p>","<p>8.\u8fdd\u7ea6\u8bb0\u5f55\u5c06\u5728\u6bcf\u5b66\u671f\u521d\u6e05\u96f6\uff08\u5177\u4f53\u65f6\u95f4\u4e3a\uff1a3\u67081\u65e5\u548c9\u67081\u65e5\uff09\u3002<\/p>","<p>9.\u8bfb\u8005\u5728\u5ea7\u4f4d\u7ba1\u7406\u7cfb\u7edf\u7f51\u9875\/\u5fae\u4fe1\u516c\u4f17\u53f7\u201c\u6211\u7684\u4e2d\u5fc3\u201d\u91cc\uff0c\u53ef\u67e5\u8be2\u672c\u4eba\u8fdd\u89c4\u8bb0\u5f55\u8be6\u60c5\u3002<\/p>","<p>10.\u5173\u4e8e\u56fe\u4e66\u9986\u5ea7\u4f4d\u7ba1\u7406\u7cfb\u7edf\u89c4\u5219\u548c\u9009\u5ea7\u529e\u6cd5\uff0c\u5982\u679c\u60a8\u6709\u4efb\u4f55\u610f\u89c1\u6216\u5efa\u8bae\uff0c\u6b22\u8fce\u8054\u7cfb\uff1a<\/p>","<p>\u5317\u9986\uff08\u674e\u6587\u6b63\u9986\uff09\u3001\u897f\u9986\uff08\u9038\u592b\u9986\uff09\uff1a62788937\uff0ccircdesk@tsinghua.edu.cn<\/p>","<p>\u6587\u79d1\u56fe\u4e66\u9986\uff1a62798676\uff0chs-ic@tsinghua.edu.cn<\/p>","<p>\u6cd5\u5f8b\u56fe\u4e66\u9986\uff1a62772955\uff0clawlib@tsinghua.edu.cn<\/p>","<p>\u7f8e\u672f\u56fe\u4e66\u9986\uff1a62798810\uff0cartslib@tsinghua.edu.cn<\/p>","<p>\u91d1\u878d\u56fe\u4e66\u9986\uff1a62772511\uff0clibfinance@tsinghua.edu.cn<\/p>"],
'userid':"",
'username':"",
'access\_token':"",
'checkUrl':"/api.php/check",
'loginApi': "/api.php/login",
'logoutApi': "/api.php/logout",
'studyroominfo': "/api.php/study\_bookinfo"
};
if("zh"=="en")
window.ska.bookRule=["<p>To make full use of the library seats for all the library users, please review the guidelines before reserving.<\/p>","<p>1\u3001Seats are for the use of current Tsinghua students, faculty, and staff.<\/p>","<p>2\u3001Go to seat.lib.tsinghua.edu.cn or WeChat official account\uff08\u6e05\u534e\u5927\u5b66\u56fe\u4e66\u9986\uff09for reservations. System OPENTIME\uff1a 6\uff1a00-23\uff1a00.<\/p>","<p>3\u3001Seats may be reserved 1 day in advance.<\/p>","<p>4\u3001Reservations must be checked in in 30 minutes after beginning.<\/p>","<p>5\u3001Swipe your ID at the card reader for 60 minutes temporary leave.<\/p>","<p>6\u3001Swipe your ID at the card reader or gate control system to release your seat.<\/p>","<p>7\u3001Seats are only available during library hours.<\/p>","<p>8\u3001If you will not use the seat reserved, please use \u2018cancel the reservation\u2019 (once a day).<\/p>","<p>9\u3001If your request violates any of these guidelines, it will be cancelled and make a violation record.<\/p>","<p>10\u3001If you have 5 violation records, you will be suspended for 3 days (natural day) to use the library seats. The records will be resetted every semester (March 1st and September 1st).<\/p>","<p>11\u3001The details of violation records can be checked in the \u201cmy center\u201d on the reservation webpage or WeChat.<\/p>","<p>Any comments or suggestions on the seat management system, please contact\uff1a<\/p>","<p>Main Library North Section (Mochtar Riady Library), Main Library West Section (Yifu Library)\uff1a 62788937, circdesk@tsinghua.edu.cn<\/p>","<p>Humanities and Social Sciences Library\uff1a 62798676, hs-ic@tsinghua.edu.cn<\/p>","<p>Law Library\uff1a 62772955, lawlib@tsinghua.edu.cn<\/p>","<p>Arts Library\uff1a 62798810, artslib@tsinghua.edu.cn<\/p>","<p>Finance Library\uff1a 62772511, libfinance@tsinghua.edu.cn<\/p>"];
function teamDialog(areaname,spacename,today,starttime,endtime,title,application,ispublic){
var bookDiv = '';
bookDiv += '<div class="spacebook\_form">';
bookDiv += '<div class="spacebook\_area"><div>预约区域:'+areaname+'</div></div>';
bookDiv += '<div class="spacebook\_spaces"><div>预约空间预约:'+spacename+'</div></div>';
bookDiv += '<div class="spacebook\_time"><div>预约时间:'+today+' '+starttime+' - '+endtime+'</div></div>';
bookDiv += '<div class="spacebook\_title"><span>讨论主题:</span>'+title+'</div>';
bookDiv += '<div class="spacebook\_application" style="height:100%;"><span>讨论内容:</span><div style="width:324px;"><p style="word-wrap:break-word; word-break:normal;">'+application+'</p></div></div>';
if(ispublic == '1'){
bookDiv += '<div style="width:324px;"><div style="float:left;">欢迎其他读者参与</div></div>';
}
bookDiv += '</div>';
dialog({
id: 'team-books-dialog',
title: '预约申请信息',
skin: 'green-dialog',
padding: '40px',
fixed: false,
quickClose: true,
content: bookDiv,
onshow:function(){
},
cancelValue:'取消',
cancel:function(){ },
okValue: '确 定',
ok: function () {
}
}).showModal();
}
function getBen(str){
if (str == null) return 0;
if (typeof str != "string"){
str += "";
}
return str.replace(/[^x00-xff]/g,"01").length;
}
function getdetails(){
jQuery.ajax({
url:ska.studyroominfo,
type:'GET',
dateType:'json',
data:{'type':1},
complete: function(xhr, textStatus) {
//called when complete
},
success: function(data, textStatus, xhr) {
var rooms = data.data.list;
var tongzhi="";
var yuyue= "";
var xinxi ="";
$.each(rooms,function(i,item){
var curTime = new Date().getTime();
var startDate = curTime - (3 \* 3600 \* 24 \* 1000);
startDate = new Date(startDate);
if(item.newstitle !=null){
if(new Date(item.newstime["date"]) > startDate)
xinxi+="<li><a href=\""+item.newsid+"\" title=\""+item.newstitle+"\">"+item.newstitle+"</a><img src=\"/Public/newweb/Content/ske/images/new.gif\" width=\"45px;\" /></li>";
else
xinxi+="<li><a href=\""+item.newsid+"\" title=\""+item.newstitle+"\">"+item.newstitle+"</a></li>";
}
if(item.activity\_title !=null){
if(item.activity\_msg =="[报名进行中]")
tongzhi+="<li><a href=\""+item.activity\_id+"\" title=\""+item.activity\_title+"\">"+item.activity\_msg+' '+item.activity\_title+"</a><img src=\"/Public/newweb/Content/ske/images/new.gif\" width=\"45px;\" /></li>";
else
tongzhi+="<li><a href=\""+item.activity\_id+"\" title=\""+item.activity\_title+"\">"+item.activity\_msg+' '+item.activity\_title+"</a></li>";
}
if(item.title !=null)
yuyue+="<li><a href=\""+item.clickfunc+"\" title=\""+item.title+"\">"+item.spaceinfo.name+' 主题:'+item.title+"</a></li>";
/\*if(i<3)
{
if(item.newstitle !=null)
xinxi+="<li><a href=\""+item.newsid+"\" title=\""+item.newstitle+"\">"+item.newstitle+"</a><img src=\"/Public/newweb/Content/ske/images/new.gif\" width=\"45px;\" /></li>";
if(item.activity\_title !=null)
tongzhi+="<li><a href=\""+item.activity\_id+"\" title=\""+item.activity\_title+"\">"+item.activity\_msg+' '+item.activity\_title+"</a><img src=\"/Public/newweb/Content/ske/images/new.gif\" width=\"45px;\" /></li>";
if(item.title !=null)
yuyue+="<li><a href=\""+item.clickfunc+"\" title=\""+item.title+"\">"+item.spaceinfo.name+' 主题:'+item.title+"</a></li>";
}
else
{
if(item.newstitle !=null)
xinxi+="<li><a href=\""+item.newsid+"\" title=\""+item.newstitle+"\">"+item.newstitle+"</a></li>";
if(item.activity\_title !=null)
tongzhi+="<li><a href=\""+item.activity\_id+"\" title=\""+item.activity\_title+"\">"+item.activity\_msg+' '+item.activity\_title+"</a></li>";
if(item.title !=null)
yuyue+="<li><a href=\""+item.clickfunc+"\" title=\""+item.title+"\">"+item.spaceinfo.name+' 主题:'+item.title+"</a></li>";
}\*/
})
$("#xinxi").html(xinxi);
$("#tongzhi").html(tongzhi);
$("#yuyue").html(yuyue);
foot\_set();
},
error: function(xhr, textStatus, errorThrown) {
//called when there is an error
alertDialog('网络错误,请重试','error');
//window.location.reload();
}
});
}
setInterval(function() {
getdetails();
}, 30000);
//公告和活动是否显示
if(1==1)
$("#huodong").css("display","block");
if(0==1)
$("#gonggao").css("display","block");
if(1==1)
$("#book").css("display","block");
//首页是否显示
if(0==0){
$('.menu li:first').css("display","none");
$('.mobile\_menu li:first').css("display","none");
}
//中英文切换按钮是否显示
if(1==0){
$('#language').css("display","none");
}
$(document).ready(function(){
//检测首页大图是否启用超链接
var pic\_status = "0"==""?0:0;
if(!pic\_status)
$(".pic\_change a").attr("href","javascript:void(0);")
//检测登录
getdetails();
$(".renege").hide();
var str="";
str = str.replace(/\-/g, "/");
var expire = new Date(str);
var now = new Date();
if (ska.username && (now < expire)) {
$(".login-control").hide();
$(".logout-control").show();
}else{
$(".login-control").show();
$(".logout-control").hide();
}
//登录
$(".login-btn").click(function(event) {
login();
});
//登出
$(".logout-btn").click(function(event) {
logout();
});
});
function login(callback){
//0:汇文系统验证, 1:直接数据库验证,2:url验证,3:指定数据库直接验证,4:单点登录
if(4==4){
window.location.href="/cas/index.php?callback="+window.location.href;
return;
//$('.login\_click').attr("href","/cas/index.php");
//$('.login\_click').removeClass("login-btn");
}
loginDialog(ska.loginApi,ska.checkUrl,function(data){
if (data.status == 1) {
//设置access\_token
//设置userid
window.ska.access\_token = data.data.\_hash\_.access\_token;
window.ska.userid = data.data.\_hash\_.userid;
window.ska.username = data.data.list.name;
//显示登陆成功信息
$(".login-control").hide();
$(".logout-control").show();
//$(".login-welcome").html('我的中心');
dialog({'id':'login-dialog'}).remove();
//alertDialog('登录成功!','success',10);
bookRule(ska.bookRule);
alertDialog(data.msg,'success',500);
if (callback instanceof Function) {
callback(data);
}
}else{
var captcha\_img = $('#checkpic');
var verifyimg = captcha\_img.attr("src");
if( verifyimg.indexOf('?')>0){
$('#checkpic').attr("src", verifyimg+'&random='+Math.random());
}else{
$('#checkpic').attr("src", verifyimg.replace(/\?.\*$/,'')+'?'+Math.random());
}
if(data.status == 2){
$(".renege").show();
}
alertDialog(data.msg,'error',1,10000);
}
});
}
// setTimeout(function ()
// {
// logout();
// },360000);
function logout(){
logoutDialog(ska.logoutApi,{
'access\_token': window.ska.access\_token,
'userid': window.ska.userid
},function(data){
if (data.status == 1) {
//console.log(data);
//设置access\_token
//设置userid
window.ska.access\_token = '';
window.ska.userid = '';
//显示登陆成功信息
$(".login-control").show();
$(".logout-control").hide();
alertDialog('退出成功,欢迎使用!','success');
//如果选择CAS认证则退出时CAS端也一并退出
if(4 == 4)
window.location="/cas/index.php?logout="+window.location.href;
}else{
alertDialog(data.msg,'error');
}
});
}
//定时器返回值
var time = null;
//记录当前位子
var nexImg = 0;
//用于获取轮播图图片个数
var imgLength = $(".c-banner .banner ul li").length;
//当时动态数据的时候使用,上面那个删除
// var imgLength =0;
//设置底部第一个按钮样式
$(".c-banner .jumpBtn ul li[jumpImg=" + nexImg + "]").css("background-color", "black");
//页面加载
$(document).ready(function () {
// dynamicData();
//启动定时器,设置时间为3秒一次
time = setInterval(intervalImg, 3000);
});
//点击上一张
$(".preImg").click(function () {
//清楚定时器
clearInterval(time);
var nowImg = nexImg;
nexImg = nexImg - 1;
//console.log(nexImg);
if (nexImg < 0) {
nexImg = imgLength - 1;
}
//底部按钮样式设置
$(".c-banner .jumpBtn ul li").css("background-color", "white");
$(".c-banner .jumpBtn ul li[jumpImg=" + nexImg + "]").css("background-color", "black");
//将当前图片试用绝对定位,下一张图片试用相对定位
$(".c-banner .banner ul img").eq(nowImg).css("position", "absolute");
$(".c-banner .banner ul img").eq(nexImg).css("position", "relative");
//轮播淡入淡出
$(".c-banner .banner ul li").eq(nexImg).css("display", "block");
$(".c-banner .banner ul li").eq(nexImg).stop().animate({ "opacity": 1 }, 500);
$(".c-banner .banner ul li").eq(nowImg).stop().animate({ "opacity": 0 }, 500, function () {
$(".c-banner ul li").eq(nowImg).css("display", "none");
});
//启动定时器,设置时间为3秒一次
time = setInterval(intervalImg, 3000);
})
//点击下一张
$(".nexImg").click(function () {
clearInterval(time);
intervalImg();
time = setInterval(intervalImg, 3000);
})
//轮播图
function intervalImg() {
if (nexImg < imgLength - 1) {
nexImg++;
} else {
nexImg = 0;
}
//将当前图片试用绝对定位,下一张图片试用相对定位
$(".c-banner .banner ul img").eq(nexImg - 1).css("position", "absolute");
$(".c-banner .banner ul img").eq(nexImg).css("position", "relative");
$(".c-banner .banner ul li").eq(nexImg).css("display", "block");
$(".c-banner .banner ul li").eq(nexImg).stop().animate({ "opacity": 1 }, 300);
$(".c-banner .banner ul li").eq(nexImg - 1).stop().animate({ "opacity": 0 }, 500, function () {
$(".c-banner .banner ul li").eq(nexImg - 1).css("display", "none");
});
$(".c-banner .jumpBtn ul li").css("background-color", "white");
$(".c-banner .jumpBtn ul li[jumpImg=" + nexImg + "]").css("background-color", "black");
}
//轮播图底下按钮
//动态数据加载的试用应放在请求成功后执行该代码,否则按钮无法使用
$(".c-banner .jumpBtn ul li").each(function () {
//为每个按钮定义点击事件
$(this).click(function () {
clearInterval(time);
$(".c-banner .jumpBtn ul li").css("background-color", "white");
jumpImg = $(this).attr("jumpImg");
if (jumpImg != nexImg) {
var after = $(".c-banner .banner ul li").eq(jumpImg);
var befor = $(".c-banner .banner ul li").eq(nexImg);
//将当前图片试用绝对定位,下一张图片试用相对定位
$(".c-banner .banner ul img").eq(nexImg).css("position", "absolute");
$(".c-banner .banner ul img").eq(jumpImg).css("position", "relative");
after.css("display", "block");
after.stop().animate({ "opacity": 1 }, 300);
befor.stop().animate({ "opacity": 0 }, 500, function () {
befor.css("display", "none");
});
nexImg = jumpImg;
}
$(this).css("background-color", "black");
time = setInterval(intervalImg, 3000);
});
});