I am facing an issue that I cannot seem to debug. Every time I attempt to add my custom CSS file to the header, which is required for the script called onepage-scroll.js, I encounter an error. The script mandates placing the file in the header using
<script src="http://greenbex.com/js/onepagescroll.js"></script>
and then writing the code...
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="http://greenbex.com/css/onepage-scroll.css">
<link rel="stylesheet" type="text/css" href="http://greenbex.com/css/style.css"> //old css from another page
<link rel="stylesheet" type="text/css" href="css/font-awesome.css">
<script src="http://greenbex.com/js/onepagescroll.js"></script>
<title>ElectroFen - Team</title>
</head>
Everything works fine as intended with this setup. However, when I switch to using my new custom CSS file
<link rel="stylesheet" type="text/css" href="css/style.css">
, the page goes blank and displays an error:
Uncaught TypeError: $(...).onepage_scroll is not a function(…)I am unsure about the root cause of this problem...
The content of my CSS file begins like this:
/* Prefix */
#mainpage {
height: 100vh;
width: 100vw;
}
html {
display: none;
}
.col-md-8, .col-md-4 {
padding: 0;
margin: 0;
}
.row {
margin-right: 0;
margin-left: 0;
}
/* HOME PAGE */
....
EDIT
This is the complete code that functions properly:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="http://greenbex.com/css/onepage-scroll.css">
<link rel="stylesheet" type="text/css" href="http://greenbex.com/css/style.css">
<link rel="stylesheet" type="text/css" href="css/font-awesome.css">
<script src="http://greenbex.com/js/onepagescroll.js"></script>
<title>ElectroFen - Team</title>
</head>
<body>
<div class="main">
<section id="header">
<!-- code -->
</section>
<section id="projects">
<!-- code -->
</section>
<section id="projects">
<!-- code -->
</section>
<section id="projects">
<!-- code -->
</section>
</div>
</body>
<script src="http://greenbex.com/js/jquery.js"></script>
<script src="http://greenbex.com/js/bootstrap.js"></script>
<script src="http://greenbex.com/js/script.js"></script>
</body>
</html>
However, after adding my new custom CSS file
<link rel="stylesheet" type="text/css" href="css/style.css">
, it stops functioning correctly.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="http://greenbex.com/css/onepage-scroll.css">
<link rel="stylesheet" type="text/css" href="http://greenbex.com/css/style.css">
<link rel="stylesheet" type="text/css" href="css/font-awesome.css">
<link rel="stylesheet" type="text/css" href="css/style.css"> //this line
<script src="http://greenbex.com/js/onepagescroll.js"></script>
<title>ElectroFen - Team</title>
</head>
<body>
<div class="main">
<section id="header">
<!-- code -->
</section>
<section id="projects">
<!-- code -->
</section>
<section id="projects">
<!-- code -->
</section>
<section id="projects">
<!-- code -->
</section>
</div>
</body>
<script src="http://greenbex.com/js/jquery.js"></script>
<script src="http://greenbex.com/js/bootstrap.js"></script>
<script src="http://greenbex.com/js/script.js"></script>
</body>
</html>
Resulting in the following error message:
script.js:19 Uncaught TypeError: $(...).onepage_scroll is not a function(…)
The script.js contains:
//custom script here
onePageScroll(".main", {
sectionContainer: "section",
easing: "ease",
animationTime: 1000,
pagination: true,
updateURL: false,
beforeMove: function(index) {},
afterMove: function(index) {},
loop: true,
keyboard: true,
responsiveFallback: false
});
$(document).ready(function(){
$(".main").onepage_scroll();
});