简体   繁体   中英

Interaction. Blast.js animation when the page loads

I'm new to JavaScript and learning how to use the blast.js. I took a basic script that produces animation by click. How do I make the animation produced when the page loads?

$(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, );
    });
  });
});

try this

$(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,); 


    });
  });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM