试试下面的代码。
jQuery:
$("#slide-link").click(function () {
if($("#slider").is(":visible")){
$("#slider").hide("slide", { direction:"down" }, 1000);
$("#slide-link").animate({top: '380px'}, 1050)
} else if($("#slider").is(":hidden")) {
$("#slider").show("slide", { direction:"down" }, 1000);
$("#slide-link").animate({top: '0px'}, 950)
}
});
CSS中的修改:
#global-container
{
background-image : url(http://www.google.com/logos/2012/javelin-2012-hp.jpg);
height: 400px; /* Added Height */
overflow: hidden; /* Added Overflow Property */
}
#slider
{
margin : 20px 0 0 0; /* Added Top Margin */
width : 100px;
height : 400px;
background : green;
position : relative;
}
/* Added New Style */
#slide-link
{
position: absolute;
top:0;
left:0;
z-index:9999;
height: 20px;
}