为什么使用fullpage时候用move.js的onLeave无法触发第二次效果也无法回调到上以页面,通过Chrome提示移动必须使用元素或选择器进行初始化,请问问题出现在哪里怎么解决,代码如下:<!doctype html><html><head><meta charset="utf-8"><title>fullpage熟悉</title><link rel="stylesheet" type="text/css" href="css/jquery.fullPage.css"><style type="text/css">*body{ padding:0; margin:0;}.section{ text-align:center;}.section1 h1{ font-size:70px;}.section1 h3{ font-size:30px;}.section1 p{ font-size:18px; margin-top:800px;}.seciton2 h3{ font-size:30px; margin-left:-1500px;}.seciton2 p{ font-size:18px; margin-left:1500px;}</style></head><body><div id="fullpage"> <div class="section section1"> <h1>fullpage练习</h1> <h3>现在开始</h3> <p>这是第一个页面</p> </div> <div class="section section2"> <h3>左边进攻</h3> <p>右边进攻</p> </div></div><script type="text/javascript" src="js/jquery-2.1.4.js"></script><script type="text/javascript" src="js/jquery.fullPage.js"></script><script type="text/javascript" src="js/move.js"></script><script type="text/javascript"> $(document).ready(function() { $('#fullpage').fullpage({ sectionsColor:['red','yellow'], anchors:['page1','page2'], navigation:true, navigationPosition:'right', navigationTooltips:['page1','page2'], afterLoad:function(link,index){ switch(index){ case 1:move('.section1 h1').scale(1.5).end(); move('.section1 h3').scale(0.7).end(); move('.section1 p').set('margin-top','5%').end(); break; case 2:move('.section2 h3').set('margin-left','20%').end(); move('.section2 p').set('margin-left','-20%').end(); break; default: break; } }, onLeave:function(link,index){ switch(index){ case 1:move('section1 h1').scale(1).end(); move('section1 h3').scale(1).end(); move('section1 p').set('margin-top','800px').end(); break; case 2:move('.section2 h3').set('margint-left','-1500px').end(); move('.section2 p').set('margint-left','1500px').end(); break; default: break; } }, afterRender:function(){ }, }); });</script></body></html>
- 1 回答
- 0 关注
- 1282 浏览
添加回答
举报
0/150
提交
取消