PageSourceSearch

http://badakencoder.com/home/js/follower.js

js badakencoder.com collected 2026-10-04 13:27:49 UTC 2,901 bytes, 86 lines download raw bytes

1/***********************/
2/* [email protected] */
3/* http://blog.bits.kr */
4/*          2009/10/16 */
5/***********************/
6
7/*
8jquery플러그인이므로 jquery를 필수로 사용해야 동작하는 스크립트입니다.
9
10pageAlign : center 또는 left
11pageWidth : 컨텐츠 블럭의 폭(필수값)
12type      : right 또는 left(pageAlign의 값을 center로 했을때만 left값 사용가능)
13topMargin : 페이지 최상단과의 거리
14minTop    : 스크롤 했을때 브라우저 상단과의 거리(topMargin과 같은 값을 넣으면 같은 높이 유지)
15margin    : 컨텐츠 블럭과의 좌 또는 우의 마진(left일때는 오른쪽 마진, right일때는 왼쪽 마진)
16speed     : 따라다니는 속도
17easing    : linear 또는 swing (easing plugin 플러그인을 쓴다면 플러그인 옵션값을 모두 사용할 수 있음)
18zindex    : 필요하다면...
19*/
20(function($) {
21  var $doc = $(document);
22  var $win = $(window);
23  $.fn.scrollFollower = function (options){
24    var options = $.extend({}, $.fn.scrollFollower.defaults, options);
25		if (options.pageWidth)
26			var pageWidth    = parseInt(options.pageWidth);
27		else
28		{
29			alert('pageWidth는 필수 옵션값입니다.');
30			return false;
31		}
32    var $layer = $(this);
33    var varType      = options.varType;
34    var pageAlign    = options.pageAlign;
35    var offset       = pageWidth/2;
36    var layerPositon = options.type;
37    var margin       = parseInt(options.margin);
38    var speed        = parseInt(options.speed);
39    var easing       = options.easing;
40    var topMargin    = parseInt(options.topMargin);
41    var minTop       = parseInt(options.minTop);
42    var marginResult = offset + margin;
43    $layer.css('z-index', options.zindex);
44    $layer.css("position","absolute");
45    if (layerPositon === 'left')
46     varType = 'right';
47    function resetXPosition()
48    {
49      if (pageAlign === 'center')
50      {
51        var $screenSize = $('body').width();
52        var halfScreenSize = $screenSize/2;
53        xPosition = halfScreenSize + marginResult;
54      }
55      else if (pageAlign === 'left')
56      {
57        varType   = 'left';
58        xPosition = pageWidth + margin;
59      }
60      $layer.css(varType, xPosition);
61    }
62    resetXPosition();
63    $layer.css('top',topMargin);
64    $win.resize(resetXPosition);
65    $win.scroll(function(){
66      $top = $doc.scrollTop();
67      if ($top > topMargin + minTop)
68        yPosition = $top + minTop;
69      else
70        yPosition = $top + topMargin;
71      $layer.animate({"top":yPosition }, {duration:speed, easing:easing, queue:false});
72    });
73  };
74  $.fn.scrollFollower.defaults = {
75    varType:'left',
76    pageAlign:'left',
77    type:'left',
78    topMargin:0,
79    minTop:0,
80    margin:0,
81    padding:0,
82    speed:1000,
83    easing:'linear',
84    zindex:10
85    };
86})( jQuery );

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.