我正在使用这里找到的代码jQuery - 动态div高度
<script type='text/javascript'>
$(function(){
$('#center').css({'height':(($(window).height())-162)+'px'});
$(window).resize(function(){
$('#center').css({'height':(($(window).height())-162)+'px'});
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
现在,当您调整窗口大小时,高度更改工作正常,但如果向下滚动高度不会改变,这意味着窗口属性不包括超出浏览器窗口大小的内容,因此如果向下滚动高度不会增加
所以我可以添加的是整个内容的大小而不是窗口大小
答案使用文档而不是窗口
<script type='text/javascript'>
$(function(){
$('#center').css({'height':(($(document).height())-162)+'px'});
$(window).resize(function(){
$('#center').css({'height':(($(document).height())-162)+'px'});
});
});
</script>
Run Code Online (Sandbox Code Playgroud) 我有一个包含.jpg,.png,.gif图像的zip档案目录.我想解压缩每个存档,只获取图像并将它们放在一个带有存档名称的文件夹中.
所以:
files/archive1.zip
files/archive2.zip
files/archive3.zip
files/archive4.zip
Run Code Online (Sandbox Code Playgroud)
打开archive1.zip - take sunflower.jpg,rose_sun.gif.创建文件夹files/archive1 /并将图像添加到该文件夹,so files/archive1/folder1.jpg,files/archive1/rose_sun.gif.对每个存档执行此操作.
我真的不知道如何做到这一点,欢迎所有的建议.我有超过600个档案,自动解决方案将成为救星,最好是Linux解决方案.
使用此代码
<?php
foreach (glob("*.txt") as $filename) {
$file = $filename;
$contents = file($file);
$string = implode($contents);
echo $string;
echo "<br></br>";
}
?>
Run Code Online (Sandbox Code Playgroud)
我可以显示文件夹中任何txt文件的内容,问题是所有格式化等等,从txt文件跳过
txt文件看起来像
#nipponsei @ irc.rizon.net presents:
Title: Ah My Goddess Sorezore no Tsubasa Original Soundrack
Street Release Date: July 28, 2006
------------------------------------
Tracklist:
1. Shiawase no Iro On Air Ver
2. Peorth
3. Anata ni Sachiare
4. Trouble Chase
5. Morisato Ka no Nichijou
6. Flying Broom
7. Megami no Pride
8. Panic Station
9. Akuryou Harai
10. …Run Code Online (Sandbox Code Playgroud) 我想要包含20px×20px潜在背景图像的迷你菜单.当用户点击其中一个时,身体背景图像将会改变,选择将保存为用户选择.
我曾想过使用滑块,但我不知道如何将图像放入a li并能够根据选择更改body css.
有任何想法吗?
7月4日快乐
编辑我试图保存该cookie中的img url,它不工作,它在cookie中保存但它没有检索cookie内容
编辑以下作品,!!!!!!! 但即使我添加一个,背景颜色也总是白色 $("html").css("background-color","red");
FIX,在网址末尾添加颜色
$("html").css("background", "url('" + imgCookieLink + "') no-repeat fixed center top #343837");
$(document).ready(function() {
$("#BGSelector a").click(function() {
var imgLink = $("img", this).attr("src");
$.cookie("html_img", "" + imgLink + "", { expires: 7 });
var imgCookieLink = $.cookie("html_img");
$("html").css("background", "url('" + imgCookieLink + "')");
});
});
<script type="text/javascript">
$(document).ready(function() {
$("#BGSelector a").click(function() {
var imgLink = $("img", this).attr("src");
$.cookie("html_img", "" + imgLink + "", { path: '/vitamovie', expires: 7 }); …Run Code Online (Sandbox Code Playgroud)