当前位置: 首页 > >

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;



友情链接: