fullpage.js-页面加载时未定义的变量

时间:2018-07-25 20:37:24

标签: jquery fullpage.js

我正在将fullpage.js用于我的网站。 我每次滚动节时都使用afterRender回调加载索引号和节名称,但是我注意到在页面加载时,不仅有索引和节名称,而且还有单词 undefined

这是完整的代码:

$(document).ready(function() {

  var deleteLog = false;    
  var placeHolder = $('#callbacks-placeholder');
  var sectionHolder = $('#section-name');



  $('#fullpage').fullpage({
    v2compatible: true, 
    //Navigation
    menu: '#mymenu',
    lockAnchors: false,
    anchors:['intro','aboutme','portfolio','skills','career','contacts'],
    navigation: true,
    navigationPosition: 'right',
    navigationTooltips: ['intro', 'aboutme','portfolio', 'skills','career', 'concacts'],
    showActiveTooltip: true,
    slidesNavigation: false,
    slidesNavPosition: 'bottom',

    //Scrolling
    css3: true,
    scrollingSpeed: 700,
    autoScrolling: true,
    fitToSection: true,
    fitToSectionDelay: 1000,
    scrollBar: true,
    easing: 'easeInOutCubic',
    easingcss3: 'ease',
    loopBottom: false,
    loopTop: true,
    loopHorizontal: true,
    continuousVertical: false,
    continuousHorizontal: false,
    scrollHorizontally: false,
    interlockedSlides: false,
    dragAndMove: false,
    offsetSections: false,
    resetSliders: false,
    fadingEffect: false,
    normalScrollElements: '#element1, .element2',
    scrollOverflow: false,
    scrollOverflowReset: false,
    scrollOverflowOptions: null,
    touchSensitivity: 15,
    normalScrollElementTouchThreshold: 5,
    bigSectionsDestination: null,

    //Accessibility
    keyboardScrolling: true,
    animateAnchor: true,
    recordHistory: true,

    //Design
    controlArrows: true,
    verticalCentered: true,
    sectionsColor : ['#ebebeb', '#fcccc'],
    paddingTop: '0px',
    paddingBottom: '0px',
    fixedElements: '',
    responsiveWidth: 0,
    responsiveHeight: 0,
    responsiveSlides: false,
    parallax: false,
    parallaxOptions: {type: 'reveal', percentage: 62, property: 'translate'},

    //Custom selectors
    sectionSelector: '.section',
    slideSelector: '.slide',

    lazyLoading: false,

    //events
    onLeave: function(anchorLink, index, nextIndex, direction) {
      if (deleteLog) {

        placeHolder.html('').fadeIn();
        sectionHolder.html('').fadeOut();
      }

    },

    afterLoad: function(anchorLink, index) {
      placeHolder.append('<h2>' + index + '</h2>' );
      sectionHolder.append('<h3>' + anchorLink + '</h3>').fadeIn();
      deleteLog = true;
    },
    afterRender: function(anchorLink, index){
      placeHolder.append('<h2>' + index + '</h2>' );
      sectionHolder.append('<h3>' + anchorLink + '</h3>').fadeIn();
      deleteLog = true; 

    },
    afterResize: function(){width, height},
    afterResponsive: function(isResponsive){},
    afterSlideLoad: function(section, origin, destination, direction){},
    onSlideLeave: function(section, origin, destination, direction){}
  });



  //methods
  $.fn.fullpage.setAllowScrolling(false);

});

浏览网站时,索引显示正确,没有未定义。

我该如何解决问题?

谢谢!

0 个答案:

没有答案