<div class="codetitle"> <span><a style="CURSOR: pointer" data="69781" class="copybut" id="copybut69781" onclick="doCopy('code69781')"><u>复代码码</u></a></span> 代码如下:</div> <div class="codebody" id="code69781"> <br><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 전환//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <br><html xmlns="http://www.w3.org/1999/xhtml" > <br><머리> <br><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <br><제목></제목> <br><style type="text/css"> <br>본문 <br>{ <br>높이:2000px; <br>} <br>.float_mx{ <br>배경:#CCC; <br>폭:100px; <br>높이:100px; <br>디스플레이:없음; <br>} <br></style> <br></head> <br><본문> <br><div class="float_mx"> <br>지금 此添加内容 <br></div> <br><script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script> <br><script type="text/javascript"> <br>(function($) { <br>$.fn.scrollBox = function(options){ <br>var defaultOptions = { <br>속도: 0.1, //加速 <br>시간: 16, //移动速degree <br>top: 200, //默认顶부분 <br>align: 'right', //浮动位置,可选左、右 <br>mix: 0 //边距 <br>} <br>var options = $.extend(defaultOptions, options); <br>this.each(function(){ <br>var obj = $(this); <br>init(); <br>function init(){ <br>obj.css('display', 'block'); <br>obj.css('position', 'absolute') <br>obj.css(options.align, options.mix); .css('top', options.top 'px'); <br>obj.css('z-index', '99') <br>move() <br>} <br>function back( ) { <br>가속 = 옵션.속도; <br>var x1 = 0 <br>var x2 = 0; 0; <br>if (document.documentElement) { <br>x1 = document.documentElement.scrollLeft || 0; <br>y1 = document.documentElement.scrollTop || 0; .body) { <br>x2 = document.body.scrollLeft || 0; <br>y2 = document.body.scrollTop || 0 <br>} <br>var x = Math.max(x1, x2) ; <br>var y = Math.max(y1, y2); <br>var 속도 = 가속도; <br>return { <br>l: x, <br>t: y, <br>s: 속도 🎜>}; <br>}; <br><br>function move(){ <br>vartip = obj; <br>var old = options.top; <br>var pos = back().t; <br>pos = pos - $(tip).Coordinate().y options.top; <br>pos = $(tip).Coordinate().y pos / 10; <br>if (pos < options.top) { <br>pos = options.top; <br>} <br>if (pos != old) { <br>tip.css('top',pos "px"); <br>} <br>오래된 = pos; <br>window.setTimeout(function(){move();}, options.time); <br>}; <br>}); <br>}; <br>$.fn.Coordinate = function(){ <br>var E = $(this)[0]; <br>var C = E.offsetTop; <br>var B = E.offsetLeft; <br>var A = E.offsetWidth; <br>var D = E.offsetHeight; <br>while (E = E.offsetParent) { <br>C = E.offsetTop; <br>B = E.offsetLeft; <br>} <br>return { <br>x: B, <br>y: C, <br>w: A, <br>h: D <br>}; <br>}; <br>})(jQuery); <br>$('.float_mx').scrollBox(); <br></script> <br></body> <br></html> <br><br><br><br>复代码<br><br><br> 代码如下:</div> <div class="codebody" id="code61495"> <br>(function($) { <br>$.fn.scrollBox = function(options){ <br>var defaultOptions = { <br>속도: 0.1, //加速 <br>시간: 16, //移动速degree <br>top: 200, //默认顶부분 <br>align: 'right', //浮动位置,可选左、右 <br>mix: 0 //边距 <br>}; 🎜>var options = $.extend(defaultOptions, options); <br>this.each(function(){ <br>var obj = $(this); <br>init(); <br>function init() { <br>obj.css('display', 'block'); <br>obj.css('position', 'absolute') <br>obj.css(options.align, options.mix); 🎜>obj.css('top', options.top 'px'); <br>obj.css('z-index', '99') <br>move() <br>} function back() { <br>가속 = options.speed; <br>var x1 = 0 <br>var x2 = 0; var y2 = 0; <br>if (document.documentElement) { <br>x1 = document.documentElement.scrollLeft || 0; <br>y1 = document.documentElement.scrollTop || 0; if (document.body) { <br>x2 = document.body.scrollLeft || 0; <br>y2 = document.body.scrollTop || 0 <br>} var x = Math.max(x1) , x2); <br>var y = Math.max(y1, y2); <br>var 속도 = 가속도 <br>return { <br>l: x, <br>t: y, <br>s : 속도 <br>}; <br>}; <br><br>function move(){ <br>vartip = obj; <br>var old = options.top; <br>var pos = back().t; <br>pos = pos - $(tip).Coordinate().y options.top; <br>pos = $(tip).Coordinate().y pos / 10; <br>if (pos < options.top) { <br>pos = options.top; <br>} <br>if (pos != old) { <br>tip.css('top',pos "px"); <br>} <br>오래된 = pos; <br>window.setTimeout(function(){move();}, options.time); <br>}; <br>}); <br>}; <br>$.fn.Coordinate = function(){ <br>var E = $(this)[0]; <br>var C = E.offsetTop; <br>var B = E.offsetLeft; <br>var A = E.offsetWidth; <br>var D = E.offsetHeight; <br>while (E = E.offsetParent) { <br>C = E.offsetTop; <br>B = E.offsetLeft; <br>} <br>return { <br>x: B, <br>y: C, <br>w: A, <br>h: D <br>}; <br>}; <br>})(jQuery); <br><br> </div>