所以我需要一些帮助。divs中图像的宽度和高度
我做了这个设置是我需要一些图像来总是全屏幕(缩放到适合)div放在里面。这是我到底有多远,无论我做什么,我都无法让它工作。我真的希望有人能帮我解决这个问题,这让我疯狂!我试图把这样的代码
background: url(images/bg.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
但是然后图像消失......这里是整个代码。
HTML
<div class="wrapper">
<div class="navigation_top">
<ul>
<li>Btn_1</li>
<li>Btn_2</li>
<li>Btn_3</li>
<li>Btn_4</li>
<li>Btn_5</li>
</ul>
</div>
<div class="navigation_side">
<ul>
<li><a href="#slice1" id="btn_1" class="anchorLink">slice1</a></li>
<li><a href="#slice2" id="btn_2" class="anchorLink">slice2</a></li>
<li><a href="#slice3" id="btn_3" class="anchorLink">slice3</a></li>
<li><a href="#slice4" id="btn_4" class="anchorLink">slice4</a></li>
<li><a href="#slice5" id="btn_5" class="anchorLink">slice5</a></li>
</ul>
</div>
<div id="slice1"></div>
<div id="slice2"></div>
<div id="slice3"></div>
<div id="slice4"></div>
<div id="slice5"></div>
</div>
CSS
html, body {height:100%; color:#FFF;}
ul, ol, li {margin:0px!important; padding:0px!important;}
.wrapper {width:100%; height:100%;}
.navigation_top {width:100%; height:50px; line-height:50px; background-color:#000; opacity:.5; position:fixed;}
.navigation_top ul {list-style:none;}
.navigation_top ul li {float:left; width:100px; text-align:center;}
.navigation_top ul li a {display:block; color:#FFF; text-decoration:none;}
.navigation_side {width:200px; height:auto; position:fixed; background-color:#000; opacity:.5; margin-top:10%;}
.navigation_side ul li a {color:#FFF; text-decoration:none;}
#slice1 {width:100%; height:100%; background:url(http://img405.imageshack.us/img405/6018/image1uii.jpg);}
#slice2 {width:100%; height:100%; background-color:#999;}
#slice3 {width:100%; height:100%; background-color:#888;}
#slice4 {width:100%; height:100%; background-color:#777;}
#slice5 {width:100%; height:100%; background-color:#666;}
JQUERY
jQuery(document).ready(function($) {
$(".anchorLink").click(function(event){
event.preventDefault();
$('html,body').animate({scrollTop:$(this.hash).offset().top}, 500);
});
$('.navigation_top').hide();
$(window).scroll(function() {
// the 10 below is the number of pixels down to show the menu
if ($(this).scrollTop() > 10) $('.navigation_top').show();
else $('.navigation_top').hide();
});
});
而且这里是我的p的小提琴rogress:http://jsfiddle.net/iBertel/qLTQ9/
你试图将“全屏”图像设置为哪个元素?你不会把它分配给CSS中的任何东西。 – Lowkase
每一个切片都需要自己的“全屏”图像,现在只是第一个图像和休息的颜色 - 最终他们将有自己的图片,应该填写该分区...希望你明白我的意思?编辑:基本上它应该是现在的颜色,而不是切片中的不同颜色它应该是图片。 – Bertel