jquery使用CSS3实现文字动画效果插件Textillate.js

Textillate是一款基于jquery的使用CSS3实现文字动画的小巧插件。Textillate.js集成了一些很棒的使用CSS3动画效果的 JavaScript 库,您可非常轻轻松地把这些动画效果应该于网页中的任何文字。

Textillate 下载          案例演示

Textillate

使用方法

引入核心文件

<link href="assets/animate.css" rel="stylesheet">
<script src="http://libs.useso.com/js/jquery/1.9.0/jquery.min.js"></script>
<script src="assets/jquery.lettering.js"></script>

构建html标签

<h1 class="tlt">My Title</h1>

写入JS,初始化

$(function () {
    $('.tlt').textillate();
})

 

以上代码使用了默认的动画效果,如果你想改变动理效果,可以在html中调用data API

<h1 class="tlt" data-in-effect="rollIn">Title</h1>

你也可以在初始化时使用参数来改变

$('.tlt').textillate({ in: { effect: 'rollIn' } });

当然,你也可以用Textillate给一个列表的文字都具有动画

复制代码
<h1 class="tlt">
    <ul class="texts">
        <li data-out-effect="fadeOut" data-out-shuffle="true">Some Title</li>
        <li data-in-effect="fadeIn">Another Title</li>
    </ul>
</h1>
$('.tlt').textillate();
复制代码

 

注意:你可以通过调用data api配置动画参数来控制每个li的动画效果。

参数选项

复制代码
$('.tlt').textillate({
  // the default selector to use when detecting multiple texts to animate
  selector: '.texts',
  // enable looping
  loop: false,
  // sets the minimum display time for each text before it is replaced
  minDisplayTime: 2000,
  // sets the initial delay before starting the animation
  // (note that depending on the in effect you may need to manually apply 
  // visibility: hidden to the element before running this plugin)
  initialDelay: 0,
  // set whether or not to automatically start animating
  autoStart: true,
  // custom set of 'in' effects. This effects whether or not the 
  // character is shown/hidden before or after an animation  
  inEffects: [],
  // custom set of 'out' effects
  outEffects: [ 'hinge' ],
  // in animation settings
  in: {
    // set the effect name
    effect: 'fadeInLeftBig',
    // set the delay factor applied to each consecutive character
    delayScale: 1.5,
    // set the delay between each character
    delay: 50,
    // set to true to animate all the characters at the same time
    sync: false,
    // randomize the character sequence 
    // (note that shuffle doesn't make sense with sync = true)
    shuffle: false,
    // reverse the character sequence 
    // (note that reverse doesn't make sense with sync = true)
    reverse: false,
    // callback that executes once the animation has finished
    callback: function () {}
  },
  // out animation settings.
  out: {
    effect: 'hinge',
    delayScale: 1.5,
    delay: 50,
    sync: false,
    shuffle: false,
    reverse: false,
    callback: function () {}
  },
  // callback that executes once textillate has finished 
  callback: function () {}});
复制代码

 

事件

  • start.tlt – textillate开始时触发
  • inAnimationBegin.tlt – 动画进入开始时触发
  • inAnimationEnd.tlt – 动画进入结束时触发
  • outAnimationBegin.tlt –  动画退出开始时触发
  • outAnimationEnd.tlt – 动画退出结束时触发
  • end.tlt – ttextillate结束触发

方法

  • $element.textillate(‘start’) – 手动开始或重启 textillate
  • $element.textillate(‘stop’) – 手动暂停或停止 textillate
  • $element.textillate(‘in’) – 当前文字动画进入时触发
  • $element.textillate(‘out’) – 当前文字动画退出时触发
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
YOLO高分设计资源源码,详情请查看资源内容中使用说明 YOLO高分设计资源源码,详情请查看资源内容中使用说明 YOLO高分设计资源源码,详情请查看资源内容中使用说明 YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明
使用HTML、CSS、JavaScript、jQuery和Vue.js编写网站可以实现丰富的交互和动态效果。下面是一个简单的示例: HTML部分: ```html <!DOCTYPE html> <html> <head> <title>My Website</title> <link rel="stylesheet" type="text/css" href="styles.css"> </head> <body> <header> <h1>Welcome to My Website</h1> </header> <nav> <ul> <li><a href="#">Home</a></li> <li><a href="#">About</a></li> <li><a href="#">Services</a></li> <li><a href="#">Contact</a></li> </ul> </nav> <main> <section> <h2>About</h2> <p>This is a brief description of my website.</p> </section> <section> <h2>Services</h2> <ul> <li>Web Design</li> <li>Graphic Design</li> <li>Front-end Development</li> </ul> </section> </main> <footer> <p>© 2021 My Website. All rights reserved.</p> </footer> <script src="jquery.min.js"></script> <script src="vue.min.js"></script> <script src="script.js"></script> </body> </html> ``` CSS部分(styles.css): ```css body { font-family: Arial, sans-serif; margin: 0; padding: 0; } header { background-color: #333; color: #fff; padding: 20px; } nav { background-color: #666; color: #fff; padding: 10px; } nav ul { list-style-type: none; margin: 0; padding: 0; } nav ul li { display: inline; margin-right: 10px; } nav ul li a { color: #fff; text-decoration: none; } main { padding: 20px; } section { margin-bottom: 20px; } footer { background-color: #333; color: #fff; padding: 10px; text-align: center; } ``` JavaScript部分(script.js): ```javascript $(document).ready(function() { // jQuery代码 $('h1').click(function() { $(this).css('color', 'red'); }); }); new Vue({ el: 'main', data: { message: 'Hello Vue.js!' } }); ``` 在这个示例中,我们使用HTML创建了网站的基本结构,使用CSS样式化网站的外观,使用JavaScript和jQuery实现了一些交互效果使用Vue.js实现了数据绑定和动态更新。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值