Team:ZJU-China/Notebook/week1

From 2011.igem.org

(Difference between revisions)
 
(43 intermediate revisions not shown)
Line 1: Line 1:
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
<html>  
-
<html xmlns="http://www.w3.org/1999/xhtml">
+
 
-
<head>
+
<head>
-
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
+
<style type="text/css">
-
<title>CSS制作滑动折叠的文字效果 网页设计手册 www.websbook.com</title>
+
 
-
</head>
+
#banner {position:relative; width:950px; height:345px; border:1px solid #666; overflow:hidden;}
-
<style type="text/css">
+
#banner_list img {border:0px;width:950px; height:343px;}
-
<!--
+
 
-
body,div,ul,li,p,h1,h2{ margin:0; padding:0; border:0; background:#FAFAFA; font-family:Arial, Helvetica, sans-serif,"宋体"}
+
#banner ul {position:absolute;list-style-type:none;filter: Alpha(Opacity=80);opacity:0.8; border:1px solid #fff;z-index:1002;
-
body{ text-align:center; font-size:12px}
+
            margin:0; padding:0; bottom:3px; right:5px;}
-
li{ list-style:none}
+
#banner ul li { padding:0px 8px;float:left;display:block;color:#FFF;border:#e5eaff 1px solid;background:#6f4f67;cursor:pointer}
-
.rolinList{ width:402px; height:auto; margin:20px auto 0 auto; text-align:left}
+
#banner ul li.on { background:#900}
-
.rolinList li{margin-bottom:1px;border:1px solid #DADADA}
+
#banner_list a{position:absolute;} <!-- 让四张图片都可以重叠在一起-->
-
.rolinList li h2{ width:380px; height:40px; background:#fff; font-size:14px; line-height:40px; padding-left:20px; color:#333; cursor:pointer}
+
-
.n_content{ height:150px;width:400px;  background:#fff;  background:#FAFAFA}
+
-
.n_content p{ margin:12px}
+
-
-->
+
</style>
</style>
 +
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
 +
</head>
 +
 +
<body>
<script type="text/javascript">
<script type="text/javascript">
-
//<![CDATA[
+
    var t = n = 0, count;
-
window.onload = function() {
+
    $(document).ready(function(){  
-
rolinTab("rolin")
+
        count=$("#banner_list a").length;
-
}
+
        $("#banner_list a:not(:first-child)").hide();
-
function rolinTab(obj) {
+
        $("#banner_info").html($("#banner_list a:first-child").find("img").attr('alt'));
-
var list = $(obj).getElementsByTagName("LI");
+
        $("#banner_info").click(function(){window.open($("#banner_list a:first-child").attr('href'), "_blank")});
-
var state = {show:false,hidden:false,showObj:false};
+
        $("#banner li").click(function() {
-
for (var i=0; i<list.length; i++) {
+
            var i = $(this).text() - 1;//获取Li元素内的值,即1,2,3,4
-
var tmp = new rolinItem(list[i],state);
+
            n = i;
-
if (i == 0) tmp.pShow();
+
            if (i >= count) return;
-
}
+
            $("#banner_info").html($("#banner_list a").eq(i).find("img").attr('alt'));
-
}
+
            $("#banner_info").unbind().click(function(){window.open($("#banner_list a").eq(i).attr('href'), "_blank")})
-
function rolinItem(obj,state) {
+
            $("#banner_list a").filter(":visible").fadeOut(500).parent().children().eq(i).fadeIn(1000);
-
var speed = 0.0666;
+
            document.getElementById("banner").style.background="";
-
var range = 1;
+
            $(this).toggleClass("on");
-
var interval;
+
            $(this).siblings().removeAttr("class");
-
var tarH;
+
        });
-
var tar = this;
+
        t = setInterval("showAuto()", 4000);
-
var head = getFirstChild(obj);
+
        $("#banner").hover(function(){clearInterval(t)}, function(){t = setInterval("showAuto()", 4000);});
-
var content = getNextChild(head);
+
    })
-
var isOpen = false;
+
   
-
this.pHidden = function() {
+
    function showAuto()
-
if (isOpen) hidden();
+
    {
-
}
+
        n = n >=(count - 1) ? 0 : ++n;
-
this.pShow = show;
+
        $("#banner li").eq(n).trigger('click');
-
var baseH = content.offsetHeight;
+
    }
-
content.style.display = "none";
+
-
var isOpen = false;
+
-
head.onmouseover = function() {
+
-
this.style.background = "#EFEFEF";
+
-
}
+
-
head.onmouseout = mouseout;
+
-
head.onclick = function() {
+
-
this.style.background = "#EFEFEF";
+
-
if (!state.show && !state.hidden) {
+
-
if (!isOpen) {
+
-
head.onmouseout = null;
+
-
show();
+
-
} else {
+
-
hidden();
+
-
}
+
-
}
+
-
}
+
-
function mouseout() {
+
-
this.style.background = "#FFF"
+
-
}
+
-
function show() {
+
-
head.style.borderBottom = "1px solid #DADADA";
+
-
state.show = true;
+
-
if (state.openObj && state.openObj != tar ) {
+
-
state.openObj.pHidden();
+
-
}
+
-
content.style.height = "0px";
+
-
content.style.display = "block";
+
-
content.style.overflow = "hidden";
+
-
state.openObj = tar;
+
-
tarH = baseH;
+
-
interval = setInterval(move,10);
+
-
}
+
-
function showS() {
+
-
isOpen = true;
+
-
state.show = false;
+
-
}
+
-
function hidden() {
+
-
state.hidden = true;
+
-
tarH = 0;
+
-
interval = setInterval(move,10);
+
-
}
+
-
function hiddenS() {
+
-
head.style.borderBottom = "none";
+
-
head.onmouseout = mouseout;
+
-
head.onmouseout();
+
-
content.style.display = "none";
+
-
isOpen = false;
+
-
state.hidden = false;
+
-
}
+
-
function move() {
+
-
var dist = (tarH - content.style.height.pxToNum())*speed;
+
-
if (Math.abs(dist) < 1) dist = dist > 0 ? 1: -1;
+
-
content.style.height = (content.style.height.pxToNum() + dist) + "px";
+
-
if (Math.abs(content.style.height.pxToNum() - tarH) <= range ) {
+
-
clearInterval(interval);
+
-
content.style.height = tarH + "px";
+
-
if (tarH != 0) {
+
-
showS()
+
-
} else {
+
-
hiddenS();
+
-
}
+
-
}
+
-
}
+
-
}
+
-
var $ = function($) {return document.getElementById($)};
+
-
String.prototype.pxToNum = function() {return Number(this.replace("px",""))}
+
-
function getFirstChild(obj) {
+
-
var result = obj.firstChild;
+
-
while (!result.tagName) {
+
-
result = result.nextSibling;
+
-
}
+
-
return result;
+
-
}
+
-
function getNextChild(obj) {
+
-
var result = obj.nextSibling;
+
-
while (!result.tagName) {
+
-
result = result.nextSibling;
+
-
}
+
-
return result;
+
-
}
+
-
//]]>
+
</script>
</script>
-
<body>
+
 
-
<ul class="rolinList" id="rolin">
+
 
-
<li>
+
<div id="banner">   
-
<h2>网页设计手册 www.websbook.com</h2>
+
    <div id="banner_bg"></div> <!--标题背景-->
-
<div class="n_content"><p>域名:<br /><br />
+
    <div id="banner_info"></div> <!--标题-->
-
网页设计手册论坛http://bbs.websbook.com<br />
+
    <ul>
-
网页设计手册团队博客http://blog.websbook.com<br />
+
        <li class="on">1</li>
-
网页设计手册首页 <br />
+
        <li>2</li>
-
我们致力于为中文网站提供动力</p></div>
+
        <li>3</li>
-
</li>
+
        <li>4</li>
-
<li>
+
  <li>5</li>
-
<h2>网页设计手册 websbook.com</h2>
+
  <li>6</li>
-
<div class="n_content"><p>域名:www.cnidc.com<br />
+
    </ul>
-
网页设计师与建站爱好者之家, <br />
+
  <div id="banner_list">
-
网页设计师与建站爱好者之家, <br />
+
        <a href="#" target="_blank"><img src="https://static.igem.org/mediawiki/2011/e/e2/Zju-h1.jpg" title="" alt="" /></a>
-
网页设计师与建站爱好者之家, <br />
+
        <a href="#" target="_blank"><img src="https://static.igem.org/mediawiki/2011/0/00/Zju-h2.jpg" title="" alt="" /></a>
-
网页设计师与建站爱好者之家</p></div>
+
        <a href="#" target="_blank"><img src="https://static.igem.org/mediawiki/2011/5/54/Zju-h3.jpg" title="" alt="" /></a>
-
</li>
+
        <a href="#" target="_blank"><img src="https://static.igem.org/mediawiki/2011/7/7f/Zju-h4.jpg" title="" alt="" /></a>
-
<li>
+
  <a href="#" target="_blank"><img src="https://static.igem.org/mediawiki/2011/8/86/Zju-h5.jpg" title="" alt="" /></a>
-
<h2>网页设计手册 websbook.com </h2>
+
  <a href="#" target="_blank"><img src="https://static.igem.org/mediawiki/2011/7/76/Zju-h6.jpg" title="" alt="" /></a>
-
<div class="n_content"><p>网页设计师与建站爱好者之家,<br />
+
    </div>
-
网页设计师与建站爱好者之家,<br />
+
-
网页设计师与建站爱好者之家,<br />
+
-
网页设计师与建站爱好者之家 websbook.COM</p></div>
+
-
</li>
+
-
<li>
+
-
<h2>网页设计手册论坛</h2>
+
-
<div class="n_content"><p>bbs.websbook.com <br />
+
-
网页设计师与建站爱好者之家,<br />
+
-
网页设计师与建站爱好者之家、<br />
+
-
网页设计师与建站爱好者之家、<br />
+
-
网页设计师与建站爱好者之家。</p>
+
-
</div>
+
-
</li>
+
-
<li>
+
-
<h2>网页设计手册 www.websbook.com</h2>
+
-
<div class="n_content"><p>域名:<br /><br />
+
-
网页设计手册论坛http://bbs.websbook.com<br />
+
-
网页设计手册首页<br />
+
-
网页设计手册首页 <br />
+
-
网页设计师与建站爱好者之家</p></div>
+
-
</li>
+
-
<li>
+
-
<h2>网页设计手册论坛</h2>
+
-
<div class="n_content"><p>bbs.websbook.com <br />
+
-
网页设计师与建站爱好者之家,<br />
+
-
网页设计师与建站爱好者之家、<br />
+
-
网页设计师与建站爱好者之家、<br />
+
-
网页设计师与建站爱好者之家。</p>
+
</div>
</div>
-
</li>
 
-
</ul>
 
</body>
</body>
 +
</html>
</html>

Latest revision as of 03:34, 5 October 2011