【发布时间】:2015-01-28 14:26:13
【问题描述】:
我在 angular-fullstac-generator 项目上实现 fullpage.js 时遇到问题。然后问题是我已经用凉亭安装了它,然后我尝试按照说明使用它。为了测试,我将以下代码添加到 index.html 中,其中是控制器和指令以及其他内容的脚本。 我在 jquery.js 之后发布了这个。
index.html:
<script>
$(document).ready(function() {
$('#fullpage').fullpage({
//Navigation
menu: false,
anchors:['firstSlide', 'secondSlide'],
navigation: false,
navigationPosition: 'right',
navigationTooltips: ['firstSlide', 'secondSlide'],
slidesNavigation: true,
slidesNavPosition: 'bottom',
//Scrolling
css3: true,
scrollingSpeed: 700,
autoScrolling: true,
scrollBar: false,
easing: 'easeInQuart',
easingcss3: 'ease',
loopBottom: false,
loopTop: false,
loopHorizontal: true,
continuousVertical: false,
normalScrollElements: '#element1, .element2',
scrollOverflow: false,
touchSensitivity: 15,
normalScrollElementTouchThreshold: 5,
//Accessibility
keyboardScrolling: true,
animateAnchor: true,
recordHistory: true,
//Design
controlArrows: true,
verticalCentered: true,
resize : true,
sectionsColor : ['#ccc', '#fff'],
paddingTop: '3em',
paddingBottom: '10px',
fixedElements: '#header, .footer',
responsive: 0,
//Custom selectors
sectionSelector: '.section',
slideSelector: '.slide',
//events
onLeave: function(index, nextIndex, direction){},
afterLoad: function(anchorLink, index){},
afterRender: function(){},
afterResize: function(){},
afterSlideLoad: function(anchorLink, index, slideAnchor, slideIndex){},
onSlideLeave: function(anchorLink, index, slideIndex, direction){}
});
});
</script>
和局部视图:
<div id="fullpage">
<div class="section">Some section</div>
<div class="section">Some section</div>
<div class="section">Some section</div>
<div class="section">Some section</div>
</div>
我得到了错误:
" fullPage: 错误!Fullpage.js 需要用选择器初始化。例如:$('#myContainer').fullpage();"
如何解决这个问题?谢谢回答!
【问题讨论】:
-
如果您使用 Angular.js 使用的 AJAX 技术,您可能会多次调用初始化。指向您网站的链接将有助于解决问题。
标签: javascript jquery angularjs fullpage.js