#first_image {
width : 100%;
min-width: 1100px;
position: fixed;
top : 0;
left : 0;
z-index: -2;
}
main {
width:100%;
position:relative;
top:;
background-color: black;
z-index: 100;
padding-top:25px;
}
JS:
var img = document.getElementById('first_image');
var height = img.clientHeight;
$(".maintext").css({ top: height });
编辑:.maintext是main的类。
答案 0 :(得分:1)
在$(function() {
function imageHeight() {
var img = document.getElementById('first_image');
var height = img.clientHeight;
$(".maintext").css({ top: height });
}
$(window).resize(function() {
imageHeight();
});
imageHeight();
});
事件处理程序中调用相同的代码。这里是完整的代码,添加了您将图像大小调整为函数所做的事情,以便您可以在页面加载时自行调用该函数,并在调整窗口大小时调用它。
int numberoffiles = 0;
private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
if (e.Error == null)
{
label7.Text = "Processing done";
numberoffiles = ExtractImages.imagesUrls.Count();
label9.Text = ExtractImages.imagesUrls.Count().ToString();
newList.AddRange(ExtractImages.imagesUrls.OrderByDescending(s => s.Contains("region=is")));
btnDownload.Enabled = true;
progressBar2.Value = 0;
CreateCountryDateTimeDirectories(newList);
downloadFile(newList);
}
}