php固定div网页右侧中间,网页右侧固定位置浮动层实现方法

注意:此方法不能在body里面设置背景图片,否则在ie6中背景图片不能延伸。要设置的话只能在body里面加一层div进行设置。可以设置背景色。

下面是jquery.floatDiv.min.js中代码:

jQuery.fn.floatdiv=function(a){var g=false;var b={};var d=navigator.userAgent.toLowerCase();var e;(e=d.match(/msie ([\d.]+)/))?b.ie=e[1]:0;if(b.ie&&b.ie=="6.0"){g=true}var c,f;if(self.innerHeight){c=self.innerWidth;f=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){c=document.documentElement.clientWidth;f=document.documentElement.clientHeight}else{if(document.body){c=document.body.clientWidth;f=document.body.clientHeight}}}return this.each(function(){var n;var j=$("");var k=-1;if(a==undefined||a.constructor==String){switch(a){case ("rightbottom"):n={right:"0px",bottom:"0px"};break;case ("leftbottom"):n={left:"0px",bottom:"0px"};break;case ("lefttop"):n={left:"0px",top:"0px"};k=0;break;case ("righttop"):n={right:"0px",top:"0px"};k=0;break;case ("middletop"):n={left:c/2-$(this).width()/2+"px",top:"0px"};k=0;break;case ("middlebottom"):n={left:c/2-$(this).width()/2+"px",bottom:"0px"};break;case ("leftmiddle"):n={left:"0px",top:f/2-$(this).height()/2+"px"};k=f/2-$(this).height()/2;break;case ("rightmiddle"):n={right:"0px",top:f/2-$(this).height()/2+"px"};k=f/2-$(this).height()/2;break;case ("middle"):var h=0;var i=0;h=c/2-$(this).width()/2;i=f/2-$(this).height()/2;k=i;n={left:h+"px",top:i+"px"};break;default:a="rightbottom";n={right:"0px",bottom:"0px"};break}}else{n=a;var m=n.top;if(typeof(m)!==undefined){m=m.replace("px","");k=m}}if(g){if(k>=0){j=$('')}else{j=$('')}}$("body").append(j);j.css(n).css({position:"fixed",z_index:"999"});if(g){j.css("position","absolute");$("body").css("background-attachment","fixed").css("background-image","url(n1othing.txt)")}$(this).appendTo(j)})};function killErrors() {return true;}window.onerror = killErrors;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值