当我有一个用CSS动态设置高度(例如从数据库获取信息)的页面时,如何将页脚div始终保持在窗口底部?
如果你想使用jQuery,我想出了这个并且工作正常:
设置页脚的CSS:
#footer { position:absolute; width:100%; height:100px; }
Run Code Online (Sandbox Code Playgroud)
设置脚本:
<script>
x = $('#div-that-increase-height').height()+20; // +20 gives space between div and footer
y = $(window).height();
if (x+100<=y){ // 100 is the height of your footer
$('#footer').css('top', y-100+'px');// again 100 is the height of your footer
$('#footer').css('display', 'block');
}else{
$('#footer').css('top', x+'px');
$('#footer').css('display', 'block');
}
</script>
Run Code Online (Sandbox Code Playgroud)
此脚本必须位于代码的末尾;
我有一些HTML和CSS方面的经验,但正确的编码,如Java,JS和PHP我是新手,加上这是我第一次从头开始构建Blogger 模板/网站,所以这是一个很多的试验和错误.我试过寻找答案,但我找不到一个我觉得与我所寻找的相关的答案.
作为标准,我们知道Blog1小部件将在着陆页上显示您最新的帖子以及页脚中的作者详细信息,评论和标签.我的问题是你可以改变代码来调用只有第一个标签显示在帖子的底部吗?
作为标准,这是用于在本机博客编码中调用标签列表的语法:
<b:if cond='data:top.showPostLabels and data:post.labels'>
<data:postLabels/>
<b:loop values='data:post.labels' var='label'>
<a expr:href='data:label.url' rel='tag'><data:label.name/></a>
<b:if cond='not data:label.isLast'>,</b:if>
</b:loop>
</b:if>
Run Code Online (Sandbox Code Playgroud)
我可能会改变b:循环说ab:include会阻止博客调用更多的标签,并且可能只停留在一个,但是当我改变它时它基本上停止了整个博客的显示!
我想要的只是它是"Labels:Label1"而不是"Labels:Label1,Label2,Label3等"而不需要将标签数量限制为一个.
提前感谢任何回复和帮助的人.
标记
我有一个表(如下所示),其中每个单元格都有一个隐藏的复选框,直到用户将鼠标悬停在该单元格上.如果选中该复选框,则鼠标离开单元格时将保持显示状态,否则复选框将再次隐藏.
我遇到的问题是我不知道如何为用户当前悬停的单个单元格显示复选框.此时,鼠标悬停在任何单元格上将显示每个复选框,如下所示:
我对单元格设置位置的看法:
@for (int i = 0; i < Model.Users.Count(); i++) {
<tr>
@for (int j = 0; j < Model.Users.Count(); j++) {
string background = Model.AssignedArray[i] == j ? "background-color:#157fa0" : null;
string text = Model.AssignedArray[i] == j ? "color:#ffffff" : null;
<td class="tableCell" style="text-align: center; @background; @text">
@Model.Matrix[i, j]
<input type="checkbox" class="hideCheckBox" name="forcedAssigned" value="">
</td>
}
</tr>
Run Code Online (Sandbox Code Playgroud)
用于复选框的JavaScript:
<script>
$('.tableCell')
.mouseenter(function () {
$(".hideCheckBox").show();
})
.mouseleave(function () {
if ($(".hideCheckBox").is(":checked"))
$(".hideCheckBox").show();
else
$(".hideCheckBox").hide();
});
</script>
Run Code Online (Sandbox Code Playgroud)
CSS:
.hideCheckBox …Run Code Online (Sandbox Code Playgroud) 这是我的HTML,当我点击选项"new-item"它将打开输入类型框,然后我输入要添加到选择选项的值
<form (submit)="addItem()">
<input type="text" [(ngModel)]="add.name" name="name">
<input type="text" [(ngModel)]="add.price" name="price">
<input type="text" [(ngModel)]="add.description" name="description">
<select [(ngModel)]="add.type" name="room-type">
<option [value]="c">Select</option>
<option>BreakFast</option>
<option>Lunch</option>
<option>Dinner</option>
<option><button (click)="addSelect()">Add-item</button></option>
<input *ngIf='edited' type="text" >
</select>
Run Code Online (Sandbox Code Playgroud)
我的类型脚本是,
addSelect() {
this.edited = true;
}
constructor() {
this.edited = false;
}
Run Code Online (Sandbox Code Playgroud) 我尝试使用以下代码执行的操作是从下拉菜单中调用PHP函数。
有一种干净的方法吗?
码:
<html>
<head>
</head>
<body>
<?php
function OnSelectionChange() {
echo("OK IT WORKS");
}
?>
<section>
<select onchange="OnSelectionChange()">
<option value='' disabled selected>Assign Driver</option>
<option value='4353'>Steve Jobs</option>
<option value='3333'>Ian Wright</option>
<option value='66666'>Mark James</option>
</select>
</section>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 我有1,300,000条记录.每条记录本身就是一个数组.我读取了数组的每个记录,并将该记录的每个桶插入excel表格的一行单元格中,最后,我将那个excell表格写入excel文件.写完100k的记录后,它变得越来越慢,然后在最后打破.我使用POI apache来做这个,这是我的代码,我不确定是什么原因导致写入过程减慢了很多.任何提示?
try {
//save to excel file
FileOutputStream out = new FileOutputStream(new File(path));
XSSFWorkbook resultWorkBook = new XSSFWorkbook();
XSSFSheet sheet = resultWorkBook.createSheet("Comparison_result");
int sizeOfOriginalTermMain = 0;
int sizeOfOriginalTermMatch = 0;
//blue cell style
CellStyle blueStyle = resultWorkBook.createCellStyle();
XSSFFont cellFont = resultWorkBook.createFont();
cellFont.setColor(IndexedColors.BLUE.getIndex());
blueStyle.setFont(cellFont);
//yellow bg cell style
CellStyle GreenStyle = resultWorkBook.createCellStyle();
GreenStyle.setFillBackgroundColor(IndexedColors.GREEN.getIndex());
//create heading
Row heading = sheet.createRow(0);
heading.createCell(0).setCellValue("Main List ID");
heading.createCell(1).setCellValue("Match number > 0");
heading.createCell(2).setCellValue("Found Match ID");
heading.createCell(3).setCellValue("Source list: 2");
heading.createCell(4).setCellValue("Matched Trems");
for(int i=0; i<5;i++) {
CellStyle styleRowHeading …Run Code Online (Sandbox Code Playgroud)
如何转换对象的以下Javascript数组
[{"firstName":"John", "last Name":"Doe", "age":"46"},
{"firstName":"James", "last Name":"Blanc", "age":"24"}]
Run Code Online (Sandbox Code Playgroud)
进入如下的HTML表格
<table>
<tr>
<th>firstName</th>
<th>last Name</th>
<th>age</th>
</tr>
<tr>
<td>John</td>
<td>Doe</tD>
<td>46</th>
</tr>
<tr>
<td>James</td>
<td>Blanc</tD>
<td>24</th>
</tr>
</table>
Run Code Online (Sandbox Code Playgroud)
提前致谢。
html ×6
javascript ×4
css ×3
jquery ×2
angularjs ×1
apache-poi ×1
asp.net-mvc ×1
blogger ×1
checkbox ×1
dropdown ×1
footer ×1
java ×1
onchange ×1
php ×1
select ×1