I have completely overhauled your code with numerous improvements. The original version seemed disorganized, so I decided to start fresh. You can see the updated code at this Fiddle link
// Declare variables
var $header_top = $('.header-top');
var $nav = $('nav');
// Toggle menu functionality
$header_top.find('a').on('click', function() {
$(this).parent().toggleClass('open-menu');
});
// Customize fullpage settings
$('#fullpage').fullpage({
sectionsColor: [],
sectionSelector: '.vertical-scrolling',
navigation: true,
slidesNavigation: true,
controlArrows: false,
anchors: ['home', 'about', 'contact'],
menu: '#menu',
afterLoad: function(anchorLink, index) {
$header_top.css('background', 'rgba(0, 47, 77, .3)');
$nav.css('background', 'rgba(0, 47, 77, .25)');
if (index == 5) {
$('#fp-nav').hide();
}
},
onLeave: function(index, nextIndex, direction) {
if(index == 5) {
$('#fp-nav').show();
}
},
afterSlideLoad: function( anchorLink, index, slideAnchor, slideIndex) {
if(anchorLink == 'fifthSection' && slideIndex == 1) {
$.fn.fullpage.setAllowScrolling(false, 'up');
$header_top.css('background', 'transparent');
$nav.css('background', 'transparent');
$(this).css('background', '#374140');
$(this).find('h2').css('color', 'white');
$(this).find('h3').css('color', 'white');
$(this).find('p').css(
{
'color': '#DC3522',
'opacity': 1,
'transform': 'translateY(0)'
}
);
}
},
...
</section>
</div>
</div></answer1>
<exanswer1><div class="answer" i="53369819" l="4.0" c="1542600471" a="TWlsbGhvcm4=" ai="2464865">
<p>I have made several updates to your code. I decided to start from scratch because it seemed a bit scattered. You can view the updated version on <a href="http://jsfiddle.net/webfrogs/okfyqn4x/" rel="nofollow noreferrer">this Fiddle link</a></p>
<div>
<pre><code>// variables
var $header_top = $('.header-top');
var $nav = $('nav');
// toggle menu
$header_top.find('a').on('click', function() {
$(this).parent().toggleClass('open-menu');
});
// fullpage customization
$('#fullpage').fullpage({
sectionsColor: [],
sectionSelector: '.vertical-scrolling',
navigation: true,
slidesNavigation: true,
controlArrows: false,
anchors: ['home', 'about', 'contact'],
menu: '#menu',
afterLoad: function(anchorLink, index) {
$heeader_top.css('background', 'rgba(0, 47, 77, .3)');
$vanv.css('background', 'rgba(0, 47, 77, .25)');
if (index == 5) {
$('#fp-nav').hide();
}
},
onLeave: function(index, nextIndex, direction) {
if(index == 5) {
$('#fp-nav').show();
}
},
afterSlideLoad: function( anchorLink, index, slideAnchor, slideIndex) {
if(anchorLink == 'fifthSection' && slideIndex == 1) {
$.fn.fullpage.setAllowScrolling(false, 'up');
$header_top.css('background', 'transparent');
$nav.css('background', 'transparent');
$(this).css('background', '#374140');
$(this).find('h2').css('color', 'white');
$(this).find('h3').css('color', 'white');
$(this).find('p').css(
{
'color': '#DC3522',
'opacity': 1,
'transform': 'translateY(0)'
}
);
}
},
...
</section>
</div>
</div></answer1>
<exanswer1><div class="answer" i="53369819" l="4.0" c="1542600471" a="TWlsbGhvcm4=" ai="2464865">
<p>I've implemented several enhancements in your code. I chose to begin anew as the existing code appeared helter-skelter. Feel free to check out the updated version on this Fiddle - <a href="http://jsfiddle.net/webfrogs/okfyqn4x/" rel="nofollow noreferrer">See Fiddle</a></p>
<p><div>
<div>
<pre class="lang-js"><code>// Variable declarations
var $header_top = $('.header-top');
var $nav = $('nav');
// Menu toggle functionality
$header_top.find('a').on('click', function() {
$(this).parent().toggleClass('open-menu');
});
// Setting up fullpage customization
$('#fullpage').fullpage({
sectionsColor: [],
sectionSelector: '.vertical-scrolling',
navigation: true,
slidesNavigation: true,
controlArrows: false,
anchors: ['home', 'about', 'contact'],
menu: '#menu',
afterLoad: function(anchorLink, index) {
$header_top.css('background', 'rgba(0, 47, 77, .3)');
$nav.css('background', 'rgba(0, 47, 77, .25)');
if (index == 5) {
$('#fp-nav').hide();
}
},
onLeave: function(index, nextIndex, direction) {
if(index == 5) {
$('#fp-nav').show();
}
},
afterSlideLoad: function( anchorLink, index, slideAnchor, slideIndex) {
if(anchorLink == 'fifthSection' && slideIndex == 1) {
$.fn.fullpage.setAllowScrolling(false, 'up');
$header_top.css('background', 'transparent');
$nav.css('background', 'transparent');
$(this).css('background', '#374140');
$(this).find('h2').css('color', 'white');
$(this).find('h3').css('color', 'white');
$(this).find('p').css(
{
'color': '#DC3522',
'opacity': 1,
'transform': 'translateY(0)'
}
);
}
},
...
@import url(https://fonts.googleapis.com/css?family=Alegreya+Sans:300,400,700);
/* Icon styles using custom font */
... // CSS for icon styling
/* Helper classes */
... // Additional CSS helper classes
/* Reset general styles */
... // General style reset rules
/* Navigation styles */
... // Styling for header and top navigation bar
/* Section styles for fullPage.js */
... // Styles specific to different sections
/* SlideNav styles for fullPage.js*/
... // Style rules for slide navigation
/* Media query styles */
... // Responsive design styles
}
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/fullPage.js/2.6.6/jquery.fullPage.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fullPage.js/2.6.6/jquery.fullPage.min.js"></script>
<header>
<div class="header-top clearfix">
<h1 class="l-left"><a href="#home">Your Logo</a></h1>
<a class="l-right toggle-menu" href="#">
<i></i>
<i></i>
<i></i>
</a>
</div>
<nav class="hide">
<ul id="menu">
... // Navigation list items
</ul>
</nav>
</header>
<div id="fullpage">
... // Sections content
</div>