fixed

<!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="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
.FloatNav{width:173px;height:278px;margin-left:50%;left:520px;position:absolute; z-index:9999;display:none;}
</style>
</head>

<body>

<div class="main" style=" height:1800px;">
	<div  class="FloatNav" id="FloatNav"><img src="http://img02.taobaocdn.com/tps/i2/T1bvDsXXxpXXX5T_j0-45-135.png" border="0" usemap="#Map4" ></div>
</div>

 <script type="text/javascript"> 
 /*悬浮*/
 (function(){
 		var $=function(id){ return typeof id === "string" ? document.getElementById(id) : id };
		var FloatAdv=function(Id,Top,h){this.initialize(Id,Top,h)};
		FloatAdv.prototype={
		initialize:function(Id,Top,h){
		var _this=this;
		this.Id=$(Id);
		this.Top=Top;
		this.h=h;
		setInterval(function(){
		_this.Top += ( _this.getFloatAdvTop() + Top - _this.Top)/10;
		
		if(_this.Top>h)
		{
		_this.Id.style.display="block";
		_this.Id.style.top=Math.ceil(_this.Top)+"px";
		}
		else _this.Id.style.display="none";
		},10);
		},
		getFloatAdvTop:function(){
		return (document.documentElement.scrollTop||document.body.scrollTop||0)-(document.documentElement.clientTop||document.body.clientTop||0);
		}
		};
			new FloatAdv("FloatNav",150,500);
	})()
	
 </script>
</body>
</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="Content-Type" content="text/html; charset=gb2312" />

<title>无标题文档</title>

<style type="text/css">

.FloatNav{width:173px;height:278px;margin-left:50%;left:520px;position:absolute; z-index:9999;display:none;}

</style>

</head>


<body>


<div class="main" style=" height:1800px;">

<div  class="FloatNav" id="FloatNav"><img src="http://img02.taobaocdn.com/tps/i2/T1bvDsXXxpXXX5T_j0-45-135.png" border="0" usemap="#Map4" ></div>

</div>


 <script type="text/javascript"> 

 /*悬浮*/

 (function(){

  var $=function(id){ return typeof id === "string" ? document.getElementById(id) : id };

var FloatAdv=function(Id,Top,h){this.initialize(Id,Top,h)};

FloatAdv.prototype={

initialize:function(Id,Top,h){

var _this=this;

this.Id=$(Id);

this.Top=Top;

this.h=h;

setInterval(function(){

_this.Top += ( _this.getFloatAdvTop() + Top - _this.Top)/10;

if(_this.Top>h)

{

_this.Id.style.display="block";

_this.Id.style.top=Math.ceil(_this.Top)+"px";

}

else _this.Id.style.display="none";

},10);

},

getFloatAdvTop:function(){

return (document.documentElement.scrollTop||document.body.scrollTop||0)-(document.documentElement.clientTop||document.body.clientTop||0);

}

};

new FloatAdv("FloatNav",150,500);

})()

 </script>

</body>

</html>

方法而 固定显示:

$().scroll((){
    ();
});
(){
    = $().(),
            = $().(),
            = $().();
    $().({: (-)/++},{ : , : });
};


你可能感兴趣的:(fixed)