javascript - 将固定背景图像和滚动前部 div 添加到 html 页面

标签 javascript jquery html css

我正在尝试使用具有滚动前端 div 的 css 将固定背景添加到 html 页面。但是在这样做之后我的 JavaScript 表单没有被加载。但是当我删除该图像并清除 css 时一切正常,

添加背景图片后的style.css:

html{
width:100%;
height:100%;
position:fixed;
background: url('../images/bg.png') no-repeat center;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
}

body{
}
.wrap {
position:absolute;
width:100%;
overflow:scroll;
}

但是当我清除它时一切正常,

html{
}
body{
}
.wrap {
}

请看附件,

a

enter image description here

最佳答案

background-position: fixed;

代替

position: fixed;

编辑:虽然我不确定我是否完全理解您的问题。

关于javascript - 将固定背景图像和滚动前部 div 添加到 html 页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22483762/

相关文章:

javascript - 为什么 JavaScript 解释器得到 -8 作为语句 parseInt(1/8-9,23) 的结果?

javascript - Jquery,使用变量转义 url

javascript - 使用 jquery 在键入时更改表单的内容

html - 如何为所有显示器制作一个完美填充所有屏幕的着陆 slider ?

jquery - ASP.NET MVC 3 JSON ModelBinders 不工作

html - 如何在没有客户端脚本的情况下让 Web 客户端处理表单以将页面 ID 信息发送到服务器

javascript - 如何使用 POST 重定向时通过 onclick 和 POST 数据获取

javascript - 如何让 React Native 的 ScrollView 初始缩放不为 1?

jquery - 颜色框未正确触发 "Uncaught TypeError: Object [object Object] has no method ' 颜色框'"

javascript - 无法将 json 对象转换为二维数组