从底部向上滚动图像[CSS,Jquery]

时间:2015-01-05 00:11:51

标签: javascript jquery html css

当用户向下滚动以覆盖页面顶部的导航栏和文本时,我希望屏幕底部的图像向上滚动,这应保持文具。

这可以在css中完成,还是必须使用jQuery?

HTML:

<head>
    <link rel="stylesheet" type="text/css" href="css/style.css">
    <link href='http://fonts.googleapis.com/css?family=Alegreya+Sans:300,400,800' rel='stylesheet' type='text/css'>
</head>
<body>
    <div class="header">
        <div class="col-25">
            <img id="logo" src="images/logo-black.svg">
        </div>
        <div class= "col-50">
            <ul class="main-nav">
                <li class="main-nav-link">
                    <a href="Link" class="main-nav-text">HOME</a>
                </li>
                <li class="main-nav-link">
                    <a href="Link" class="main-nav-text">WORK</a>
                </li>
                <li class="main-nav-link">
                    <a href="Link" class="main-nav-text">SERVICES</a>
                </li>
                <li class="main-nav-link">
                    <a href="Link" class="main-nav-text">CONTACT</a>
                </li>
            </ul>
        </div>
        <div class="col-25"></div>
    </div>      
    <div class="top-section">
        <div class="top-section-bg">
            <h1 class="splash-text">We Explore Design.</h1>
        </div>
    </div>
    <div class="first-section">
    </div>
    <div class="second-section">
    </div>
    <div class="footer">
    </div>
</body>

CSS

body {
    font-family: 'Alegreya Sans', sans-serif;
    margin: 0 auto;
    margin-top: 0;
}
#logo {
    margin-left: 10px;
    margin-top: 10px;
    width: 150px;
}
.header {
    width: 100%;
    float: left;
    margin: 0 auto;
}
.col-25 {
    width: 25%;
    float: left;
}
.col-50 {
    width: 50%;
    float: left;
}
.col-33 {
    width: 33.33333%;
    float: left;
}
.col-66 {
    width: 66.66666%;
    float: left;
}
.main-nav {
    list-style-type: none;
    text-align: center;

}
.main-nav-link {
    display: inline-block;
    padding-left: 25px;
    padding-right: 25px;
    font-size: 16px;
    margin-top: 40px;

}
.main-nav-text {
    text-decoration: none;
    color: black;
    font-weight: 400;
    transition:all 0.3s ease;
}
.top-section-bg {
    -webkit-background-size:cover;
    -moz-background-size:cover;
    -o-background-size:cover;
    background-size:cover;
    background-position:center;
    height: 800px;
}
.splash-text {
    color: black;
    text-align: center;
    font-size: 80px;
    font-weight: 300;
    margin-top: 0px;
    padding-top: 250px;
}
.subtext {
    color: black;
    text-align: center;
    font-weight: 300;
    margin-top: 0px;
}
.first-section {
    background-image: url("images/diver.jpg");
    background-size: cover;
    height: 500px;
}
.splash-text-mid {
    color: white;
    text-align: center;
    font-size: 70px;
    font-weight: 300;
    margin-top: 0px;
    padding-top: 100px;
}
.second-section {
    height: 500px;
}

0 个答案:

没有答案
相关问题