zoukankan      html  css  js  c++  java
  • jquery position fixed IE6 插件

    (function($) {
    jQuery.fn.PositionFixed = function(options) {
        var defaults = {
            x:0,            //left
            y:0,            //top
            isAll : false   //是否最大化  我后加的
        };
        var o = jQuery.extend(defaults, options);
        
        var isIe6=false//is ie ? yes:ie no: not ie
        if($.browser.msie && parseInt($.browser.version)==6)
            isIe6=true;            
        
        var html= $('html');
    if (isIe6 && html.css('backgroundAttachment') !== 'fixed') {
            html.css('backgroundAttachment','fixed') 
        };
        
        return this.each(function() {
        var domThis=$(this)[0];
        var objThis=$(this);
            if(isIe6)
            {
                
                 var left = parseInt(o.x) - html.scrollLeft(),
                     top = parseInt(o.y) - html.scrollTop();
                    objThis.css('position' , 'absolute');    
                    
                    domThis.style.setExpression('left', 'eval((document.documentElement).scrollLeft + ' + o.x + ') + "px"');
                    domThis.style.setExpression('top', 'eval((document.documentElement).scrollTop + ' + o.y + ') + "px"');
                    function _resize(){
                        var w = $(window),
                            ww = w.width(),
                            hh = w.height();
                        objThis.css({
                            width : ww,
                            height : hh    
                        });
                    }
                    if(o.isAll){
                        _resize();
                        $(window).bind({
                            "resize" : _resize,
                            "scroll" : _resize    
                        });
                    }
                    
            }
            else
            {
                objThis.css('position' , 'fixed').css('top',o.y).css('left',o.x);
            }
        
        });

    };


    })(jQuery)

    用法$(**).PositionFixed()

    参数说明见代码

     
     
  • 相关阅读:
    Nginx 提示500 ,设置提示具体错误
    部署laravel 到linux环境
    php & vue 跨域问题解决方案
    一个php学习vue技术(篇章1)
    中年危机
    elasticsearch 创建索引、unassigned、elasticsearch 创建索引后出现unassigned、
    laravel jwt 报错 Argument 3 passed to LcobucciJWTSignerHmac::doVerify() must be an instance of LcobucciJWTSignerKey, null given
    laravel jwttoken jwt attempt laravel auth->attempt() 返回false
    composer 报错 Carbon 1 is deprecated, see how to migrate to Carbon 2
    php 服务端主动向客户端推送消息, php swoole websocket, 服务端向客户端推送消息, websocket主动推送消息
  • 原文地址:https://www.cnblogs.com/sniper007/p/2376075.html
Copyright © 2011-2022 走看看