我希望当我向下滚动时标题将具有背景但在顶部标题将是透明的,如此link我可以使用引导程序修复顶部的标题,但我希望它在我滚动时将被修复下来。
这是我的网站布局enter link description here
html代码是` 切换导航 CP
<!-- Cover Page Text Starts Here -->
<section class="first firstheading">
<Div class="psr">
<div class="container-fluid">
<h2 id="social">Gain International Experience</h2>
<p>We offer abroad internship programme for students and recent gradudates</p>
</div>
<ul>
<li>LONDON</li>
<li>DUBAI</li>
<li>INDIA</li>
<li>CHINA</li>
</ul>
</div>
</section>
<!-- End of Cover Page -->
<!-- Slider Starts Here -->
<section class="second-sc">
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel" data-interval="false">
<!-- Indicators -->
<div class="container-fluid second-menu">
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="second-menu-active">LONDON</li>
<li data-target="#carousel-example-generic" data-slide-to="1">DUBAI</li>
<li data-target="#carousel-example-generic" data-slide-to="2">MUMBAI</li>
<li data-target="#carousel-example-generic" data-slide-to="3">BANGALORE</li>
<li data-target="#carousel-example-generic" data-slide-to="4">BEIGING</li>
</ol>
</div>
<div class="container-fluid dots">
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="dots-active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
<li data-target="#carousel-example-generic" data-slide-to="3"></li>
<li data-target="#carousel-example-generic" data-slide-to="4"></li>
</ol>
</div>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<div class="second">
<div class="second-menu">
<h2>DUBAI INTERSHIP PROGRAMME</h2>
<p>Dubai is a great desitnation if you’re looking for corporate and real estate experience. We work with over 60 companies in Dubai</p>
<div class="second-dugme"><a href="">FIND OUT MORE</a></div>
</div>
</div>
</div>
<div class="item ">
<div class="second">
<div class="second-menu">
<h2>DUBAI INTERSHIP PROGRAMME</h2>
<p>Dubai is a great desitnation if you’re looking for corporate and real estate experience. We work with over 60 companies in Dubai</p>
<div class="second-dugme"><a href="">FIND OUT MORE</a></div>
</div>
</div>
</div>
<div class="item ">
<div class="second">
<div class="second-menu">
<h2>DUBAI INTERSHIP PROGRAMME</h2>
<p>Dubai is a great desitnation if you’re looking for corporate and real estate experience. We work with over 60 companies in Dubai</p>
<div class="second-dugme"><a href="">FIND OUT MORE</a></div>
</div>
</div>
</div>
<div class="item ">
<div class="second">
<div class="second-menu">
<h2>DUBAI INTERSHIP PROGRAMME</h2>
<p>Dubai is a great desitnation if you’re looking for corporate and real estate experience. We work with over 60 companies in Dubai</p>
<div class="second-dugme"><a href="">FIND OUT MORE</a></div>
</div>
</div>
</div>
<div class="item ">
<div class="second">
<div class="second-menu">
<h2>DUBAI INTERSHIP PROGRAMME</h2>
<p>Dubai is a great desitnation if you’re looking for corporate and real estate experience. We work with over 60 companies in Dubai</p>
<div class="second-dugme"><a href="">FIND OUT MORE</a></div>
</div>
</div>
</div>
</div>
</div>
</section>`
答案 0 :(得分:0)
这是一个你可以使用它的简单函数和jquery
$(document).ready (function () {
$(window).scroll (function () {
var sT = $(this).scrollTop();
if (sT >= 300) {
$('.overlay').addClass('cambio')
}else {
$('.overlay').removeClass('cambio')
}
})
})