Javascript 调整页面大小时的背景封面
我的页面有一些动画,有时会改变页面高度(故意的),所以最初加载页面时,页面高度为100%,背景图像会覆盖页面。 但是当它运行动画时,页面高度可以超过100%。有效覆盖所有背景的唯一方法是将背景高度从“自动”更改为更大的值(例如200%),但这样做也会更改页面高度。换句话说,在动画运行时是否可以(动态)覆盖页面,而在动画未运行时保持页面高度为100% 我的背景css代码:Javascript 调整页面大小时的背景封面,javascript,jquery,html,css,Javascript,Jquery,Html,Css,我的页面有一些动画,有时会改变页面高度(故意的),所以最初加载页面时,页面高度为100%,背景图像会覆盖页面。 但是当它运行动画时,页面高度可以超过100%。有效覆盖所有背景的唯一方法是将背景高度从“自动”更改为更大的值(例如200%),但这样做也会更改页面高度。换句话说,在动画运行时是否可以(动态)覆盖页面,而在动画未运行时保持页面高度为100% 我的背景css代码: background: url(background2.jpg)repeat 5% 5%; position: absolut
background: url(background2.jpg)repeat 5% 5%;
position: absolute;
background-size:cover;
top: 0; left: 0; right: 0; bottom: 0;
z-index: 400;
height: auto;
width: auto;
hi friends应用此css
溢出:隐藏
将避免其他元素改变页面高度。
$(document).ready(function(){
var isAnimating = $("#someid").is(':animated');
//will return true if selected element animating
if(isAnimating == true){
$('#div').css('height','value');
}
else{
$('#div').css('height','value');
}
});
background: url('') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
opacity: 0.6;
filter: alpha(opacity=60);/* For IE8 and earlier */
width: 100%;
height: 100%;
overflow: hidden;