第一次使用FullPage / js和它的伟大。几乎完成了网站,有脚本问题,但终于到了那里。
我确实有一个我无法解决的问题。在调整窗口大小时,页面不会正确对齐或搭建页面,除非我刷新。
所以我试着解决它:
JS
$( window ).resize(function() {
$.fn.fullpage.destroy('all');
if(fullPageCreated === false) {
fullPageCreated = true;
});
fullpage.js
$(document).ready(function() {
// Initializing fullpage.js
initialize(false);
function initialize(hasScrollBar){
$('#fullPage').fullpage({
anchors: ['page1', 'page2', 'page3', 'page4'],
controlArrows: true,
menu: '#menu',
//resize:true,
easingcss3: 'cubic-bezier(0.550, 0.055, 0.675, 0.190)',
animateAnchor: true,
slidesNavigation: false,
navigation: false,
fadingEffect: 'slides',
fadingEffectKey: 'YWhpbXNhaW52ZXN0bWVudHMuY29tX00zMlptRmthVzVuUldabVpXT??????',
parallax: 'sections',
parallaxKey: 'YWhpbXNhaW52ZXN0bWVudHMuY29tX09NMWNHRnlZV3hzWVhnP???????',
parallaxOptions: {
type: 'reveal',
percentage: 50,
property: 'translate',
},
scrollingSpeed: 600,
autoScrolling: true,
scrollBar: hasScrollBar,
fitToSection:true,
scrollOverflow: true,
verticalCentered: true,
});
//onLoad Scripts !NOT WORKING YET FIX!
//var fileref=document.createElement('script');
//fileref.setAttribute("type","text/javascript");
//fileref.setAttribute("src",
'http://domain/js/slick-slider.js');
$( window ).resize(function() {
$.fn.fullpage.destroy('all');
if(fullPageCreated === false) {
fullPageCreated = true;
});
//Silentmove links
$(document).on('click', '#silentp1', function(){
$.fn.fullpage.silentMoveTo('page1', 0);
});
$(document).on('click', '#silentp1-2', function(){
$.fn.fullpage.silentMoveTo('page1', 1);
});
$(document).on('click', '#silentp1-3', function(){
$.fn.fullpage.silentMoveTo('page1', 2);
});
$(document).on('click', '#silentp1-4', function(){
$.fn.fullpage.silentMoveTo('page1', 3);
});
//fadeout bckgrnd on scroll
// $(window).scroll(function() {
// $(".parallax-mirror img").css({
// 'opacity': 1 - (($(this).scrollTop()) / 250)
// }); });
}
});