【发布时间】:2015-02-19 23:51:50
【问题描述】:
即使我们调整浏览器的大小,我也试图将黄色 div 元素始终保持在房屋窗口上,但我无法仅使用 css 实现它,因此寻找 JavaScript 解决方案。
这是我的小提琴:http://jsfiddle.net/jj4fxpmy/6/
问题是当我调整浏览器大小时黄色方块向上移动。我想让它粘在房子上。保持背景位置右下角对我来说很重要:
<div class="background"></div>
<div style="position: fixed; background: none repeat scroll 0% 0% gold; top: 50%; z-index: 2147483647; height: 50px; width: 50px; left: 79%;" id="square"></div>
.background{width:100%;height:100%;top:0%;left:0%;position:fixed;
background:url(http://wallpapers.7savers.com/seasons---summer-wallpapers_1146_1920x1200.jpg) no-repeat; background-color:transparent; background-position:right bottom; background-size:100%;
任何帮助将不胜感激。
【问题讨论】:
标签: javascript jquery html css