如何使用JS淡入淡出/淡出
How to fade in fade/fade out with JS
我正试图使用此脚本仅在"page1"、"page2"、"page 3"上显示我的#标题,但在"page4"上淡出,然后在"page5"上再次淡出
我的#footer目前运行良好,它隐藏在除"page5"之外的所有页面上,它会淡出其中。
<script type="text/javascript">
$(document).ready(function () {
$.fn.fullpage({
anchors: ['page1', 'page2', 'page3', 'page4','page5'],
slidesColor: ['#000', '#000', '#000', '#000', '#000'],
'scrollOverflow': true,
css3: true,
fixedElements: '#header, #footer',
afterRender: function () {
$('#footer').hide();
$('#header').show();
},
afterLoad: function (anchor, index) {
if (index == 1, 2, 3, 4) {}
$('#footer').fadeOut();
if (index == 5) {
$('#footer').fadeIn();
}
if (index == 4) {}
$('#header').fadeOut();
if (index == 1, 2, 3, 5) {
$('#header').show();
}
}
});
});
</script>
http://jsfiddle.net/Q79kF/
谢谢你的帮助。。。
好的。。你写的顺序可能有问题。。根据您提供的代码,我相信这可能是您的问题。
标头在1,2,3中可见。。在4点淡出。。在5时淡入页脚在1,2,3,4中不可见。。但在5 时淡入
尝试
//if (index == 1, 2, 3, 4) {} //You dont need this anyway
if(index == 1, 2, 3){
$('#header').show(); //try using .css('display','block') if show() didnt work
$('#footer').hide(); //try using .css('display','none') if hide() didnt work
}
if(index == 4){
$('#header').fadeOut();
}
if(index == 5){
$('#header').fadeIn();
$('#footer').fadeIn();
}
试着调整一下。。这就是我所理解的。。如果我错了,请告诉我,我会尽力帮助你的。。
相关文章:
- Javascript将图像src更改为淡入淡出
- css(或jQuery)悬停时淡入淡出
- 将淡入淡出添加到“我的身体背景滑块”
- 多重潜水淡入淡出打开
- 添加/删除类淡入淡出不起作用
- 带有计数器、缩略图、进度条和淡入淡出效果的简单jQuery幻灯片
- 使用jquery淡入淡出
- 淡入淡出脚本不起作用
- 具有淡入淡出效果的全背景图像
- 纯 JavaScript 淡入淡出 - 淡入不起作用
- 帧淡出/淡入
- 如何在onClick事件中使用ReactJS淡出/淡入内容
- 淡出 ->淡入无法正常工作
- JQuery 淡出/淡入以创建排序列表
- 无法让元素淡出/淡入
- 正在添加'淡出/淡入'响应媒体查询
- jQuery:具有淡入和淡出(淡入)的图像
- Div won't淡出/淡入
- 淡出/淡入和上卷jquery效果
- 如何根据 SELECT 更改淡出/淡入视图