如何使文本svg动画在可见时启动
How to make text svg-animation launch when visible?
我的页面上有三个部分`
<a href="#" class="next-section">Next Section</a>
<div class="section-content">
</div>
</section>
<section id="about">
<a href="#" class="prev-section">Previous Section</a>
<a href="#" class="next-section">Next Section</a>
<div class="section-content">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="480px" height="640px" viewBox="0 0 480 640" enable-background="new 0 0 480 640" xml:space="preserve">
<rect x="68.631" y="175.105" fill="none" width="350.877" height="113.158"/>
"SVG-PATHS HERE">
</div>
</section>
<section id="services">
<a href="#" class="prev-section">Previous Section</a>
<div class="section-content">
</div>
</section>
他们用javascript 点击滚动
jQuery.fn.extend({
scrollTo : function(speed, easing) {
return this.each(function() {
var targetOffset = $(this).offset().top;
$('html,body').animate({scrollTop: targetOffset}, speed, easing);
});
}
});
$('.next-section').click(function(e){
e.preventDefault();
var $this = $(this),
$next = $this.parent().next();
$next.scrollTo(150, 'linear');
});
$('.prev-section').click(function(e){
e.preventDefault();
var $this = $(this),
$prev = $this.parent().prev();
$prev.scrollTo(150, 'linear');
});
在第二节中,我有一些svg,使用CSS进行动画处理,但我希望在svg可见时开始动画处理。我该怎么做?
您可以将一个"complete"函数传递给jQuery animate()
。该完整函数在动画完成时被调用。在该函数中,您可以向SVG中添加一个类来触发动画。
相关文章:
- 当元素在屏幕中占60%时,WOW.js启动动画
- 使用带有onclick事件的Javascript启动CSS3动画
- AngularJS指令中的动画,事件未启动
- 在 HTML 页面中嵌入动画 SVG,暂停(不启动动画)
- 在调整窗口大小时停止/重新启动动画循环
- 三.js对象启动动画/游戏循环
- 在wordpress中,在页面完全加载后启动动画
- 使用带有突发引擎和画布的“开始”按钮重新启动动画
- 动画运行完毕后重新启动动画
- AngularJs:如何在值变化时启动动画(ng-scope)
- 如果为false,拖放会将我带到另一个网站,如果为true,则会重新启动动画
- 滚动功能无法正确启动动画
- 重新启动动画jquery和javascript
- jQuery textilate .js -如何“重置”元素HTML并重新启动动画
- 如何停止和重新启动动画gif
- JQuery在stop()调用后重新启动动画
- 如何为每个对象独立启动动画(KineticJS)
- 单击鼠标启动动画gif,从第一帧开始
- jQuery停止后重新启动动画
- 滚动到时启动动画