﻿    (function($) {
        $.extend($.fn, {
            scroolView: function(setting) {
                var ps = $.extend({
                    marginOfTop: 100,
                    marginOfRight: 35,
marginOfLeft:20,
marginL:false,
                    duration: "normal"  //slow、 normal、fast 、value: 1000……
                }, setting);

if(ps.marginL==false){
                this.css({ "position": "absolute", "z-index": 500, "left": screen.width - ps.marginOfRight -this.width() }).show().animate({ "top": ps.marginOfTop });
}else {this.css({ "position": "absolute", "z-index": 500, "left": ps.marginOfLeft }).show().animate({ "top": ps.marginOfTop });}
                var thisClone = this;
                var scrollFun = function() {
                thisClone.stop().animate({ top: document.documentElement.scrollTop + ps.marginOfTop }, 1000);
                };
                if (window.attachEvent) {
                    window.attachEvent("onscroll", scrollFun);
                }
                if (window.addEventListener) {
                    window.addEventListener("scroll", scrollFun, false);
                }
                thisClone.find("#close").css({ "cursor": "pointer" }).attr("title", "关闭").hover(function() { $(this).attr("src", "/images/web/closeHover.gif"); }, 
function() { $(this).attr("src", "/images/web/close.gif"); }).click(function() { thisClone.slideUp(1000); });
                return this;
            }
        });
    })(jQuery)

