1

jQuery 为画布上特定幻灯片的特定 div 函数淡入,设置时间为 .fadeIn()。

一旦我到达我的画布网络应用程序中的第六张幻灯片(基于reveal.js - http://lab.hakim.se/reveal-js/#/),需要 div="fade" 出现。

当 div="fade" 放在第一个区域时,jQuery 函数可以完美运行,但如果它放在任何其他部分中),那么当然页面 onLoad 发生在很长时间之前(即 div id="fade " 设置为按以下方式加载 div:

jQuery:

$(function(){  // $(document).ready shorthand
  $('#fade').fadeIn(2200);
});

HTML5 Section #6(希望 div="fade" 在这里工作):

...
</section>
<!-- end section 5 -->

<!-- begin section 6 -->
<section>
<div>
<p>
<a href="#">Interviewing a Co-founder<br>
<img src="img/misc/..." width="60" height="50" />
</a>
</p>
</div>

<div id="fade" style="display:none;">
<div id="browsers">
<p>
<a href="#" target="_blank">Fundraising<br />Campaign</a>
</p>
</div> <!-- END fundraising 'browsers' -->
</div> <!-- END fade jQuery --> 
</section>
<!-- end section 6 -->

...只是作为旁注,或者对于不熟悉此画布的人,每个 ++ ... 标记下一个“幻灯片”,当您使用该应用程序时...再次,您可以在以下位置查看示例:http://lab.hakim.se/reveal-js/#/

我很高兴使用良好的老式 js 或 jquery 进行修复。

4

2 回答 2

2

从reveal.js的文档:

Reveal.addEventListener( 'slidechanged', function( event ) {
    // event.previousSlide, event.currentSlide, event.indexh, event.indexv
} );

所以,你可以fadeIn这样调用:

Reveal.addEventListener( 'slidechanged', function( event ) {
    if(event.currentSlide==6){
        $('#fade').fadeIn(2200);
    }
} );
于 2012-11-02T09:23:54.040 回答
0

你可以做类似的事情,

Reveal.addEventListener( 'slidechanged', function( event ) {                
   if(event.indexh == 1){ //to get the slide number
     $('#fade').fadeIn(2200);
   }
});
于 2014-08-18T14:00:28.497 回答