相互作用。页面加载时的Blast.js动画

时间:2018-09-12 19:29:56

标签: javascript blast.js

我是JavaScript的新手,正在学习如何使用blast.js。我拍摄了一个基本的脚本,该脚本可通过单击生成动画。页面加载后如何制作动画?

$(function() {

  $('#test').on('click', function() {
    // Blasts the title
    var words = $('h1').blast({
      delimiter: 'word'
    });

    words.each(function(i) {
      // Initialization of the position
      $(this).css({
          position: 'relative',
          top: 150,
        })
        .delay(i * 70)
        .animate({
          top: '50px'
        }, 400, );
    });
  });
});

1 个答案:

答案 0 :(得分:0)

尝试

$(function() {
    // Blasts the title
    var words = $('h1').blast({
      delimiter: 'word'
    });

    words.each(function(i) {
      // Initialization of the position
      $(this).css({
        position: 'relative',
        top: 150,



      })

        .delay(i * 70)

        .animate({top: '50px'}, 400,); 


    });
  });