浮动层效果

<style type="text/css">
#float{width:100px; height:200px; position:absolute;}
</style>
<script type="text/javascript">
    var rollWidgets = function() {
        this.html = "";
        this.id = null;
        this.posi = function(id) {
            setTimeout(function() {
                $("#" + id).css({
                    "top": $.browser.scroll().top + $.browser.client().height - 350 + "px",
                    "left": screen.width/2-500+ 980+ "px"
                }).show();
            },
                    200);
        };
        this.rool = function() {
            var _this = this;
            _this.posi(_this.id);
            $(window).bind("resize",
                    function() {
                        _this.posi(_this.id);
                    }).bind("scroll",
                    function() {
                        _this.posi(_this.id);
                    })
        };
  
    }
    var newRoll = new rollWidgets();
    newRoll.id = "float";
    newRoll.rool();
</script>

posted on 2011-09-28 14:25  lovening  阅读(208)  评论(0编辑  收藏  举报