gpt4 book ai didi

jquery - 背景图片问题

转载 作者:太空宇宙 更新时间:2023-11-04 11:50:37 25 4
gpt4 key购买 nike

我遇到了这个问题。此外,我所有的页面都有背景,我只想把它放在家里。然而,在其他页面上,它显示为 header 下的横幅。

enter image description here

我无法让图像在 jsfiddle 上工作,但这里是 link

另外,我怎样才能去掉那个滚动条?

    <title>title</title>

<meta name="viewport" content="width=device-width, initial-scale=1">

<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>

<script>

$(document).delegate('#Home', 'pageshow', function () {
var the_height = ($(window).height() - $(this).find('[data-role="header"]').height() - $(this).find('[data-role="footer"]').height());
$(this).height($(window).height()).find('[data-role="content"]').height(the_height);
});
</script>
<script>

function limitTextCount(limitField_id, limitCount_id, limitNum)
{
var limitField = document.getElementById(limitField_id);
var limitCount = document.getElementById(limitCount_id);
var fieldLEN = limitField.value.length;

if (fieldLEN > limitNum)
{
limitField.value = limitField.value.substring(0, limitNum);
}
else
{
limitCount.innerHTML = (limitNum - fieldLEN) + ' character(s) left..';
}
}

</script>


<style type="text/css">
.ui-content {
overflow:hidden;
background: transparent url(landscape.jpg);
background-size :cover;
color:#FFFFFF;
text-shadow:1px 1px 1px #000000;
}

.ui-page {
background: transparent;
}
</style>

#textarea-sendEmail
{

resize:none;
height:150px;
min-height:150px;
max-height:150px;
}

<div data-role="header" data-position="fixed" >
<h1 style="text-align:left; margin-left:40px;">Home</h1>
<a href="#bars" data-role="button" data-icon="bars" data-iconpos="notext" data-theme="a" data-inline="true">Bars</a>
</div><!-- /header -->

<div data-role="content" id="Home">
<p>Home.</p>
</div><!-- /content -->

<div data-role="footer" data-position="fixed">
<h4>Page Footer</h4>
</div><!-- /footer -->

<div data-role="panel" id="bars" data-theme="b" >
<!-- panel content goes here -->
<ul data-role="listview" >
<li data-icon="home"><a href="#Home">Home</a></li>
<li data-icon="clock"><a href="#Tee Times">Tee Times</a></li>
<li data-icon="shop"><a href="#Rates">Rates</a></li>
<li data-icon="action"><a href="#Scorecard">Scorecard</a></li>
<li data-icon="info"><a href="#Contact Us">Contact Us</a></li>
</ul>
</div><!-- /panel -->

最佳答案

JQM 在页面加载时将页面的最小高度设置为大约 230px,这样背景就不会填满整个页面

因此您需要窗口的实际高度并将其设置为最小值。您可能需要调整总窗口高度的负 120 像素,但在演示中看起来没问题

背景出现在所有页面上,因为您使用了所有页面都使用的 .ui-content 类。请改用 #home id,以便它仅用于该内容

var wh = $(window).height() - 120
$(".ui-content").css("min-height", wh+"px");

window.onresize = function(event) {
var wh = $(window).height() - 120
$(".ui-content").css("min-height", wh+"px");
};

演示

http://jsfiddle.net/wqL5yw1q/

还有这个方法

https://jqmtricks.wordpress.com/2014/12/01/content-div-height-css-solution/

关于jquery - 背景图片问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30667438/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com