jQuery Cycle Plugin with typewriter transition effect

我怕爱的太早我们不能终老 提交于 2019-12-08 04:03:39

问题


Wondering if anyone knows how to achieve a typewriter effect with the jQuery Cycle plugin.

See here for desired effect: http://www.hungry-media.com/code/jQuery/tickerType/

Thanks. Dave


回答1:


Try using Cycle's after and before transition callbacks to invoke other plugins on the element being displayed. You'll need to use a plugin dedicated only to the type effect, like Effects jTypeWriter to invoke the effect when an element is displayed.

$("#cycle-pane").cycle({
  before: function() { $(this).jTypeWriter(); }
});

<div id="cycle-pane">
  <div>First text</div>
  <div>Second text</div>
</div>

You'll need to keep an eye on the timing of Cycle transitions and the duration of the type effect and also any cleanup or reset that may need to be done if Cycle is running on a loop.




回答2:


Why not just use the plugin you referenced? Doesn't look like the Cycle plugin was built for type-writer effects.



来源:https://stackoverflow.com/questions/1103698/jquery-cycle-plugin-with-typewriter-transition-effect

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!