关于javascript浮动显示的问题
<scripttype="text/javascript">//浮动导航functionfloat_nav(dom){varright_nav=$(dom);varnav...
<script type="text/javascript">
//浮动导航
function float_nav(dom) {
var right_nav = $(dom);
var nav_height = right_nav.height();
function right_nav_position(bool) {
var window_height = $(window).height();
var nav_top = (window_height - nav_height) / 2;
if (nav_top < 170)
nav_top = 170;
if (bool) {
right_nav.stop(true, false).animate({ top: nav_top + $(window).scrollTop() }, 400);
} else {
right_nav.stop(true, false).animate({ top: nav_top }, 300);
}
right_nav.show();
}
if (!+'\v1' && !window.XMLHttpRequest) {
$(window).bind('scroll resize', function () {
if ($(window).scrollTop() > 300) {
right_nav_position(true);
} else {
right_nav.hide();
}
})
} else {
$(window).bind('scroll resize', function () {
if ($(window).scrollTop() > 300) {
right_nav_position();
} else {
right_nav.hide();
}
})
}
}
float_nav('#float');
float_nav('#left_nav');
</script>
怎样在尾部留 550px高不显示? 展开
//浮动导航
function float_nav(dom) {
var right_nav = $(dom);
var nav_height = right_nav.height();
function right_nav_position(bool) {
var window_height = $(window).height();
var nav_top = (window_height - nav_height) / 2;
if (nav_top < 170)
nav_top = 170;
if (bool) {
right_nav.stop(true, false).animate({ top: nav_top + $(window).scrollTop() }, 400);
} else {
right_nav.stop(true, false).animate({ top: nav_top }, 300);
}
right_nav.show();
}
if (!+'\v1' && !window.XMLHttpRequest) {
$(window).bind('scroll resize', function () {
if ($(window).scrollTop() > 300) {
right_nav_position(true);
} else {
right_nav.hide();
}
})
} else {
$(window).bind('scroll resize', function () {
if ($(window).scrollTop() > 300) {
right_nav_position();
} else {
right_nav.hide();
}
})
}
}
float_nav('#float');
float_nav('#left_nav');
</script>
怎样在尾部留 550px高不显示? 展开
1个回答
展开全部
可以遮挡ie6下的select元素 但是在ie6下div没有透明度;
弹出的div可以一直在浏览器屏幕中间显示 。
代码:
var _CalF = { //便捷方法
$ : function(id){return document.getElementById(id)},
create : function(id){return document.createElement(id)},
append : function(id){return document.body.appendChild(id)},
remove : function(id){return document.body.removeChild(id)}
}
function popup(openID,conID,closeID){
this.onclick(openID,conID,closeID);
}
popup.prototype = {
cssStyle : "width:100%;position:absolute;left:0;top:0;filter:alpha(opacity = 50);opacity:0.5;border:0;overflow:auto;",
createShadowDiv : function(){ //背景遮罩
var shadowDiv = _CalF.create("div");
shadowDiv.id = "shadowDiv";
shadowDiv.style.cssText = this.cssStyle;
shadowDiv.style.height = document.body.scrollHeight + "px";
shadowDiv.style.backgroundColor = "#000"
shadowDiv.style.zindex = 100;
_CalF.append(shadowDiv);
},
createIframe : function(){ //iframe
var iframe = _CalF.create("iframe");
iframe.id = "shadowIframe";
iframe.style.cssText = this.cssStyle;
iframe.style.height = document.body.scrollHeight + "px";
iframe.style.zindex = 99;
_CalF.append(iframe);
},
removeDiv : function(){
_CalF.remove(_CalF.$("shadowDiv"));
_CalF.remove(_CalF.$("shadowIframe"));
},
onclick : function(openID,conID,closeID){
var that = this;
_CalF.$(openID).onclick = function(){
if(window.ActiveXObject){ //ie6
if(!window.XMLHttpRequest){
document.body.style.cssText = "_background-image: url(about:blank);_background-attachment: fixed;";
}
}
that.createIframe();
that.createShadowDiv();
_CalF.$(conID).style.display = "block";
}
document.getElementById(closeID).onclick = function(){
_CalF.$(conID).style.display = "none";
that.removeDiv();
}
}
}
var bt = new popup("bt","orderMsg","close");
</script>
</body>
</html>
弹出的div可以一直在浏览器屏幕中间显示 。
代码:
var _CalF = { //便捷方法
$ : function(id){return document.getElementById(id)},
create : function(id){return document.createElement(id)},
append : function(id){return document.body.appendChild(id)},
remove : function(id){return document.body.removeChild(id)}
}
function popup(openID,conID,closeID){
this.onclick(openID,conID,closeID);
}
popup.prototype = {
cssStyle : "width:100%;position:absolute;left:0;top:0;filter:alpha(opacity = 50);opacity:0.5;border:0;overflow:auto;",
createShadowDiv : function(){ //背景遮罩
var shadowDiv = _CalF.create("div");
shadowDiv.id = "shadowDiv";
shadowDiv.style.cssText = this.cssStyle;
shadowDiv.style.height = document.body.scrollHeight + "px";
shadowDiv.style.backgroundColor = "#000"
shadowDiv.style.zindex = 100;
_CalF.append(shadowDiv);
},
createIframe : function(){ //iframe
var iframe = _CalF.create("iframe");
iframe.id = "shadowIframe";
iframe.style.cssText = this.cssStyle;
iframe.style.height = document.body.scrollHeight + "px";
iframe.style.zindex = 99;
_CalF.append(iframe);
},
removeDiv : function(){
_CalF.remove(_CalF.$("shadowDiv"));
_CalF.remove(_CalF.$("shadowIframe"));
},
onclick : function(openID,conID,closeID){
var that = this;
_CalF.$(openID).onclick = function(){
if(window.ActiveXObject){ //ie6
if(!window.XMLHttpRequest){
document.body.style.cssText = "_background-image: url(about:blank);_background-attachment: fixed;";
}
}
that.createIframe();
that.createShadowDiv();
_CalF.$(conID).style.display = "block";
}
document.getElementById(closeID).onclick = function(){
_CalF.$(conID).style.display = "none";
that.removeDiv();
}
}
}
var bt = new popup("bt","orderMsg","close");
</script>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询