(Function ($) {$. FN. fixedsidebar = function (options) {var defaults = {width: 100, height: 20, horizontaltype: 'left',/* left, right */horizontalvalue: 20, verticaltype: 'top',/* Top, bottom */verticalvalue: 30, berth: 'browser ',/* browser, wrap */wrapwidth: 960, ishide: false, scrolltop: 120, content: ''}; var opts = $. extend (defaults, options); var floatblock = 'floatblock _ '+ math. round (math. random () * 10000); V Ar positiontype = 'undefined' = typeof (document. Body. style. maxheight )? "Absolute": "fixed"; if (OPTs. horizontaltype! = 'Left' & opts. horizontaltype! = 'Right') {opts. horizontaltype = 'left';} If (OPTs. verticaltype! = 'Top' & opts. verticaltype! = 'Bottom ') {opts. verticaltype = 'top';} var horizontalvalue = 0; var verticalvalue = 0; sethorizontalvalue (); setverticalvalue (); $ ("body "). append ('<Div id = "' + floatblock + '" style = "width:' + opts. width + 'px; Height: '+ opts. height + 'px; position: '+ positiontype +'; top: '+ verticalvalue + 'px;' + opts. horizontaltype + ':' + horizontalvalue + 'px; Z-index: 999; overflow: hidden; "> '+ opts. content + '</div>'); If (OPTs. Ishide) {$ ("#" + floatblock + ""). hide () ;}$ (window ). scroll (function () {If ('undefined' = typeof (document. body. style. maxheight) {setverticalvalue (); $ ("#" + floatblock + "" ).css ('top', verticalvalue + "PX");} If (OPTs. ishide) {if ($ (window ). scrolltop ()> opts. scrolltop) {$ ("#" + floatblock + ""). slidedown ();} else {$ ("#" + floatblock + ""). slideup () ;}}) $ (window ). resize (function () {sethorizontalv Alue (); $ ("#" + floatblock + "" ).css (OPTs. horizontaltype, horizontalvalue + "PX"); setverticalvalue (); $ ("#" + floatblock + "" ..css ('top', verticalvalue + "PX ");}) function sethorizontalvalue () {horizontalvalue = opts. berth = 'wrapp '? ($ (Window ). width ()-opts. wrapwidth)/2-opts.width-opts.horizontalvalue: opts. horizontalvalue;} function setverticalvalue () {If ('undefined' = typeof (document. body. style. maxheight) {verticalvalue = opts. verticaltype = 'top '? $ (Window ). scrolltop () + opts. verticalvalue: $ (window ). scrolltop () + $ (window ). height ()-opts. verticalvalue;} else {verticalvalue = opts. verticaltype = 'top '? Opts. verticalvalue: $ (window). Height ()-opts. verticalvalue ;}}}) (jquery)