init.js 709 B

12345678910111213141516171819202122232425262728
  1. $(function () {
  2. $('.animated-gif').each(function (i, e) {
  3. disableGif(e)
  4. });
  5. });
  6. Reveal.addEventListener('slidechanged', initAnimatedGifs);
  7. Reveal.addEventListener('ready', initAnimatedGifs);
  8. function initAnimatedGifs(event) {
  9. $('.animated-gif', event.currentSlide).each(function (i, e) {
  10. enableGif(e)
  11. });
  12. if (event.previousSlide)
  13. $('.animated-gif', event.previousSlide).each(function (i, e) {
  14. disableGif(e)
  15. });
  16. }
  17. function enableGif(e) {
  18. var src = $(e).attr("src")
  19. $(e).attr('src', src.replace('-image.gif', '.gif'));
  20. }
  21. function disableGif(e) {
  22. var src = $(e).attr("src")
  23. $(e).attr('src', src.replace('.gif', '-image.gif'));
  24. }