[英]JS: fullpage.js moveTo() among different section
CONTEXT: 背景:
I'm trying to move between different slides within a section of fullpage.js by clicking one of 5 elements. 我正在尝试通过单击5个元素之一在fullpage.js的一部分中的不同幻灯片之间移动。
PROBLEM: 问题:
The first moveTo() - from first slide to any of the other 4 works perfectly. 第一个moveTo() - 从第一张幻灯片到任何其他4张完美。 However, once on any other slide, I cannot navigate to other slides by clicking any of the elements.
但是,一旦在任何其他幻灯片上,我无法通过单击任何元素导航到其他幻灯片。 Any help would be appreciated!
任何帮助,将不胜感激!
My JS: 我的JS:
$(document).ready(function() {
// move to quality
$( "#q" ).click(function() {
$.fn.fullpage.silentMoveTo('why', 1);
});
$( "#d" ).click(function() {
$.fn.fullpage.silentMoveTo('why', 2);
});
$( "#p" ).click(function() {
$.fn.fullpage.silentMoveTo('why', 3);
});
$( "#z" ).click(function() {
$.fn.fullpage.silentMoveTo('why', 4);
});
$( "#e" ).click(function() {
$.fn.fullpage.silentMoveTo('why', 5);
});
});
$('#fullpage').fullpage({
css3: true,
sectionsColor: ['white', 'grey', '#fff', '#fff'],
anchors:['m', 'why',],
navigation: true,
navigationPosition: 'right',
// verticalCentered:false
// 'navigationTooltips': ['fullPage.js', 'Powerful', 'Amazing', 'Simple'],
// 'showActiveTooltip': true,
}
);
My Html: 我的Html:
<div id="fullpage" class="fullpage-wrapper">
<div class="section" id="section1">
<div class="slide" id="slide1-1">
</div> <!-- End slide -->
</div>
<!-- Start section 2 - why -->
<div class="section" id="section2">
<div class="slide" id="slide2-1"> <!-- Start Why -->
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<h2 class="master-side side-default"><span>Why ?</span></h2>
<div class="col-md-8 col-center">
<a id="q" class="square img-thumbnail"> </a>
<a id="d" class="square"> </a>
<a id="p" class="square"> </a>
<a id="d" class="square"> </a>
<a id="e" class="square"> </a>
</div>
</div> <!-- End col-md-12 -->
</div> <!-- End Row -->
</div> <!-- End Container -->
</div> <!-- End Why -->
<div class="slide" id="slide2-2"> <!-- Start Quality -->
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<h2><span>Quality</span></h2>
<div class="col-md-8 col-center">
<a id="q" class="square img-thumbnail"> </a>
<a id="d" class="square"> </a>
<a id="p" class="square"> </a>
<a id="d" class="square"> </a>
<a id="e" class="square"> </a>
</div>
</div> <!-- End col-md-12 -->
</div> <!-- End Row -->
</div> <!-- End Container -->
</div> <!-- End Quality -->
Don't you get any errors in your javascript console? 你的javascript控制台中有没有错误?
In the code you posted there's a mistake here: 在您发布的代码中,这里有一个错误:
// move to quality
$( "#q").click(function() {
$.fn.fullpage.silentMoveTo('why', 1);
});
You forgot to close the string "#q"
. 你忘了关闭字符串
"#q"
。
Also, you can not have more than one id
element with the same value... You can not have two <a id="d" class="square"> </a>
like you do now. 此外,您不能拥有多个具有相同值的
id
元素...您不能像现在这样拥有两个<a id="d" class="square"> </a>
。
If that's not the problem, you should add a reproduction of the issue online, because otherwise nobody will be able to know where the problem is and therefore how to help you. 如果这不是问题,您应该在线添加问题的复制品,因为否则没有人能够知道问题所在,以及如何帮助您。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.