[英]SlideDown doesn't work with fullPage.js
guys.伙计们。 I got an headache trying to understand, how to fix it, but I don't know JavaScript at all.我在试图理解如何修复它时头疼,但我根本不懂 JavaScript。 So, please, help me with it.所以,请帮我解决这个问题。 The trouble is, that ScrollDown (maybe and Up) doesn't work, when fullPage.js enabled.问题是,当启用 fullPage.js 时,ScrollDown(可能和 Up)不起作用。 See codes.查看代码。
SlideDown:滑下:
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()
}
}
})
})
fullPage:完整页面:
$(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){
won't work in your code as detailed in fullPage.js FAQ : if($(document).scrollTop()>=200){
在fullPage.js FAQ 中详述的代码中不起作用:
fullPage.js doesn't actually scroll the site but it changes the top or translate3d property of the site. fullPage.js 实际上不会滚动站点,但会更改站点的 top 或 translate3d 属性。 Only when using the fullPage.js option scrollBar:true or autoScrolling:false it will actually scroll the site in a way it is accessible for the scrollTop property.仅当使用 fullPage.js 选项 scrollBar:true 或 autoScrolling:false 时,它才会实际滚动站点,以供 scrollTop 属性访问。
That's why you should make use of callbacks, or use the scrollBar:true
option of fullPage.js这就是为什么你应该使用回调,或者使用 fullPage.js 的scrollBar:true
选项
Example:例子:
$( "#clickme" ).click(function() {
$( "#book" ).slideDown( 150, function() {
fullpage_api.reBuild();
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.