MinecraftAccount/Application/Home/View/Common/Banner.html

98 lines
2.4 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=7;IE=9;IE=10" />
<include file="Common:JS_CSS" />
<title><block name="PageTitle"></block></title>
<block name="Head"></block>
</head>
<body>
<div class="header">
<div class="con">
<h1 class="logo">Mc魔方联机</h1>
</div>
</div>
<div class="wrap">
<div class="banner-show" id="js_ban_content">
<div class="cell bns-01">
<div class="con"></div>
</div>
<div class="cell bns-02" style="display: none;">
<div class="con"></div>
</div>
<div class="cell bns-03" style="display: none;">
<div class="con"></div>
</div>
</div>
<div class="banner-control" id="js_ban_button_box">
<a href="javascript:;" class="left"></a> <a href="javascript:;" class="right"></a>
</div>
<block name="Body"></block>
</div>
<script type="text/javascript">
(function() {
var defaultInd = 0;
var list = $('#js_ban_content').children();
var count = 0;
var change = function(newInd, callback) {
if (count)
return;
count = 2;
$(list[defaultInd]).fadeOut(400, function() {
count--;
if (count <= 0) {
if (start.timer)
window.clearTimeout(start.timer);
callback && callback();
}
});
$(list[newInd]).fadeIn(400, function() {
defaultInd = newInd;
count--;
if (count <= 0) {
if (start.timer)
window.clearTimeout(start.timer);
callback && callback();
}
});
}
var next = function(callback) {
var newInd = defaultInd + 1;
if (newInd >= list.length) {
newInd = 0;
}
change(newInd, callback);
}
var start = function() {
if (start.timer)
window.clearTimeout(start.timer);
start.timer = window.setTimeout(function() {
next(function() {
start();
});
}, 8000);
}
start();
$('#js_ban_button_box').on('click', 'a', function() {
var btn = $(this);
if (btn.hasClass('right')) {
//next
next(function() {
start();
});
} else {
//prev
var newInd = defaultInd - 1;
if (newInd < 0) {
newInd = list.length - 1;
}
change(newInd, function() {
start();
});
}
return false;
});
})();
</script>
</body>
</html>