繁体   English   中英

SlideDown 不适用于 fullPage.js

[英]SlideDown doesn't work with fullPage.js

伙计们。 我在试图理解如何修复它时头疼,但我根本不懂 JavaScript。 所以,请帮我解决这个问题。 问题是,当启用 fullPage.js 时,ScrollDown(可能和 Up)不起作用。 查看代码。

滑下:

    jQuery(document).ready(function(e){
// -- menu ---\
$(window).scroll(function () {
  var html = document.documentElement;
       // $(".blockMenu").css("top",$(document).scrollTop())
       if($('html').width()>1000){
         if($(document).scrollTop()>=200){
          $('.hedMenu').slideUp()
          $('.hedMenu2').slideDown()
        }
        else{
          $('.hedMenu2').slideUp()
          $('.hedMenu').slideDown()
        }
      }
    })
})

完整页面:

 $(document).ready(function() {
    $('#fullpage').fullpage({
     sectionsColor: ['#1bbc9b', '#4BBFC3', '#7BAABE', 'whitesmoke', '#ccddff'],
     anchors: ['firstPage', 'secondPage', '3rdPage', '4thpage', 'lastPage'],
     menu: '#menu',
     afterLoad: function(anchorLink, index){

        //section 2
        if(index == 2){
          //moving the image
          $('#section1').find('img').delay(500).animate({
           left: '0%'
         }, 1500, 'easeOutExpo');

          $('#section1').find('p').first().fadeIn(1800, function(){
           $('#section1').find('p').last().fadeIn(1800);
         });;

        }

       //section 3
       if(anchorLink == '3rdPage'){
          //moving the image
          $('#section2').find('.intro').delay(500).animate({
           left: '0%'
         }, 1500, 'easeOutExpo');
        }
      }
    });

  });

HTML 不是物理标签,因此它没有宽度。

if($(document).scrollTop()>=200){fullPage.js FAQ 中详述的代码中不起作用

fullPage.js 实际上不会滚动站点,但会更改站点的 top 或 translate3d 属性。 仅当使用 fullPage.js 选项 scrollBar:true 或 autoScrolling:false 时,它​​才会实际滚动站点,以供 scrollTop 属性访问。

这就是为什么你应该使用回调,或者使用 fullPage.js 的scrollBar:true选项

  1. “slideDown”、“slideUp”或“slideToggle”持续时间应小于或等于200
  2. 完成动画后使用 reBuild()

例子:

    $( "#clickme" ).click(function() {
      $( "#book" ).slideDown( 150, function() {
        fullpage_api.reBuild();
      });
    });

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM