1(function($) { 2 $.fn.quickLayer = function(options) { 3 var defaults = { 4 layout: 'center', 5 id: 'left-right', 6 position: 'absolute', 7 align: 'right,top', 8 container_width: 990, 9 margin_top: 100, 10 margin_right: 20, 11 margin_bottom: 100, 12 margin_left: 20, 13 scroll_top: 100, 14 index: 999 15 }; 16 var options = $.extend(defaults, options); 17 var container = $(this); 18 var align = options.align.split(','); 19 $(container).css({ 20 'display': 'none', 21 'position': options.position, 22 'z-index': options.index, 23 'top': options.margin_top, 24 'width': $(container).width() 25 }); 26 27 $(window).resize(function() { 28 var position; 29 var screen_width = $(window).width(); 30 var container_width = $('div[id=' + options.id + ']').length ? $('div[id=' + options.id + ']').width() : options.container_width; 31 32 if ($.inArray('left', $(align)) > -1) { 33 var layer_width = $(container).width(); 34 if (container_width > screen_width) { 35 position = - (layer_width + options.margin_left); 36 } else { 37 if (options.layout == 'center') { 38 position = parseInt(screen_width / 2, 0) - parseInt(container_width / 2, 0) - layer_width - options.margin_left; 39 } else { 40 position = - (layer_width + options.margin_left); 41 } 42 } 43 } else { 44 if (container_width > screen_width) { 45 position = container_width + options.margin_right; 46 } else { 47 if (options.layout == 'center') { 48 position = parseInt(screen_width / 2, 0) + parseInt(container_width / 2, 0) + options.margin_right; 49 } else { 50 position = container_width + options.margin_right; 51 } 52 } 53 } 54 $(container).css('left', position + 'px'); 55 if (options.position != 'fixed') { 56 positionTop(); 57 } 58 $(container).css('display', 'block'); 59 }).trigger('resize'); 60 61 $(window).scroll(function() { 62 var scroll_position = $(document).scrollTop(); 63 if (options.position == 'fixed') { 64 if ($.inArray('top', $(align)) > -1) { 65 position = (options.margin_top > scroll_position) ? parseInt(options.margin_top, 0) - parseInt(scroll_position, 0) : options.scroll_top; 66 $(container).css('top', position + 'px'); 67 } else { 68 var screen_height = $(window).height(); 69 var layer_height = $(container).height(); 70 var container_height = options.margin_bottom + layer_height; 71 position = (container_height > screen_height) ? 0 : screen_height - container_height; 72 $(container).css('top', position + 'px'); 73 } 74 } else { 75 if ($(container).find('input[name=vscroll]').length) { 76 if ($(container).find('input[name=vscroll]:checked').length > 0) { 77 positionTop(); 78 } else { 79 $(container).stop(); 80 } 81 } else { 82 positionTop(); 83 } 84 } 85 }).trigger('scroll'); 86 87 function positionTop() { 88 var position; 89 var screen_height = $(window).height(); 90 var scroll_position = $(document).scrollTop(); 91 var layer_height = $(container).height(); 92 if ($.inArray('top', $(align)) > -1) { 93 position = (options.margin_top > scroll_position) ? options.margin_top : options.scroll_top + scroll_position; 94 } else { 95 var container_height = options.margin_bottom + layer_height; 96 position = (container_height > screen_height) ? scroll_position : screen_height - container_height + scroll_position; 97 } 98 $(container).animate({'top': position + 'px'}, 10); 99 } 100 } 101})(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.