Проблемы с использованием fullpage.js в проекте Codepen
Я новичок в программировании и приобрел базовые навыки работы с CSS и HTML, но у меня проблемы с интеграцией fullpage.js в мой проект codepen ( https://codepen.io/Selky/project/editor/DYrVYr) - даже загрузка точных демонстрационных файлов, используемых автором (Альваро Триго) У меня все еще есть проблемы. Вот сценарии, которые вызывает демонстрационная версия:
<script type="text/javascript" src="jquery.fullPage.js"></script>
<script type="text/javascript" src="examples.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#fullpage').fullpage({
sectionsColor: ['#1bbc9b', '#4BBFC3', '#7BAABE', 'whitesmoke', '#ccddff'],
anchors: ['firstPage', 'secondPage', '3rdPage', '4thpage', 'lastPage'],
menu: '#menu',
scrollingSpeed: 1000
});
});
</script>
Буду признателен за понимание того, почему это не работает для меня. Я просмотрел другие файлы codepen (такие как https://codepen.io/alvarotrigo/pen/NxyPPp), и им, кажется, даже ничего не нужно, кроме
$('#fullpage').fullpage({
sectionsColor: ['yellow', 'orange', '#C0C0C0', '#ADD8E6'],
});
функционировать должным образом, но я не понимаю, почему или могу ли я сделать то же самое в среде проекта.
Редактировать: я добавляю весь текущий раздел заголовка демонстрационного кода, который я не могу сделать функцией:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>fullPage.js One Page Scroll Sites</title>
<meta name="author" content="Alvaro Trigo Lopez" />
<meta name="description" content="fullPage plugin by Alvaro Trigo. Create fullscreen pages fast and simple. One page scroll like iPhone website." />
<meta name="keywords" content="fullpage,jquery,alvaro,trigo,plugin,fullscren,screen,full,iphone5,apple" />
<meta name="Resource-type" content="Document" />
<link rel="stylesheet" type="text/css" href="jquery.fullPage.css" />
<link rel="stylesheet" type="text/css" href="examples.css" />
<style>
/* Sections
* --------------------------------------- */
#section0 img,
#section1 img{
margin: 20px 0 0 0;
}
#section2 img{
margin: 20px 0 0 52px;
}
#section3 img{
bottom: 0px;
position: absolute;
margin-left: -420px;
}
.intro p{
width: 50%;
margin: 0 auto;
font-size: 1.5em;
}
.twitter-share-button{
position: absolute;
z-index: 99;
right: 149px;
top: 9px;
}
</style>
<!--[if IE]>
<script type="text/javascript">
var console = { log: function() {} };
</script>
<![endif]-->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"></script>
<script type="text/javascript" src="jquery.fullPage.js"></script>
<script type="text/javascript" src="examples.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#fullpage').fullpage({
sectionsColor: ['#1bbc9b', '#4BBFC3', '#7BAABE', 'whitesmoke', '#ccddff'],
anchors: ['firstPage', 'secondPage', '3rdPage', '4thpage', 'lastPage'],
menu: '#menu',
scrollingSpeed: 1000
});
});
</script>
</head>
и моя структура папок: https://imgur.com/a/f7KhI3M
После нескольких незначительных изменений это текущий код заголовка (все еще не функционирующий):
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>fullPage.js One Page Scroll Sites</title>
<meta name="author" content="Alvaro Trigo Lopez" />
<meta name="description" content="fullPage plugin by Alvaro Trigo. Create fullscreen pages fast and simple. One page scroll like iPhone website." />
<meta name="keywords" content="fullpage,jquery,alvaro,trigo,plugin,fullscren,screen,full,iphone5,apple" />
<meta name="Resource-type" content="Document" />
<link rel="stylesheet" type="text/css" href="jquery.fullpage.css" />
<link rel="stylesheet" type="text/css" href="examples.css" />
<style>
/* Sections
* --------------------------------------- */
#section0 img,
#section1 img{
margin: 20px 0 0 0;
}
#section2 img{
margin: 20px 0 0 52px;
}
#section3 img{
bottom: 0px;
position: absolute;
margin-left: -420px;
}
.intro p{
width: 50%;
margin: 0 auto;
font-size: 1.5em;
}
.twitter-share-button{
position: absolute;
z-index: 99;
right: 149px;
top: 9px;
}
</style>
<!--[if IE]>
<script type="text/javascript">
var console = { log: function() {} };
</script>
<![endif]-->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"></script>
<script type="text/javascript" src="jquery.fullpage.js"></script>
<script type="text/javascript" src="examples.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#fullpage').fullpage({
sectionsColor: ['#1bbc9b', '#4BBFC3', '#7BAABE', 'whitesmoke', '#ccddff'],
anchors: ['firstPage', 'secondPage', '3rdPage', '4thpage', 'lastPage'],
menu: '#menu',
scrollingSpeed: 1000
});
});
</script>
</head>
Благодаря всевозможной помощи, я получил правильный заголовок (я исправил несколько путей к файлам и переключился на использование библиотек HTTPS вместо HTTP):
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>fullPage.js One Page Scroll Sites</title>
<meta name="author" content="Alvaro Trigo Lopez" />
<meta name="description" content="fullPage plugin by Alvaro Trigo. Create fullscreen pages fast and simple. One page scroll like iPhone website." />
<meta name="keywords" content="fullpage,jquery,alvaro,trigo,plugin,fullscren,screen,full,iphone5,apple" />
<meta name="Resource-type" content="Document" />
<link rel="stylesheet" type="text/css" href="jquery.fullpage.css" />
<link rel="stylesheet" type="text/css" href="examples.css" />
<style>
/* Sections
* --------------------------------------- */
#section0 img,
#section1 img{
margin: 20px 0 0 0;
}
#section2 img{
margin: 20px 0 0 52px;
}
#section3 img{
bottom: 0px;
position: absolute;
margin-left: -420px;
}
.intro p{
width: 50%;
margin: 0 auto;
font-size: 1.5em;
}
.twitter-share-button{
position: absolute;
z-index: 99;
right: 149px;
top: 9px;
}
</style>
<!--[if IE]>
<script type="text/javascript">
var console = { log: function() {} };
</script>
<![endif]-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"></script>
<script type="text/javascript" src="jquery.fullpage.js"></script>
<script type="text/javascript" src="examples.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#fullpage').fullpage({
sectionsColor: ['#1bbc9b', '#4BBFC3', '#7BAABE', 'whitesmoke', '#ccddff'],
anchors: ['firstPage', 'secondPage', '3rdPage', '4thpage', 'lastPage'],
menu: '#menu',
scrollingSpeed: 1000
});
});
</script>
</head>
2 ответа
Проблема в том, что вы используете fullPage.js в своем HTML, но имя вашего файла - jquery.fullpage.js. Помните, что пути чувствительны к регистру.
Вся страница /jquery.fullpage.extensions.min.js
неверно, так как у вас нет папки на всю страницу
jquery.fullpage.extensions.min.js
должно быть правильным,
Вы неправильно связали файл <link rel="stylesheet" type="text/css" href="../jquery.fullPage.css" />
Так должно быть <link rel="stylesheet" type="text/css" href="jquery.fullpage.css" />