Pregunta

After a user incorrectly inputs their login details, the webpage reloads and an error message is displayed asking them to insert their details again. But I would like the error message div to bounce a few times when the page reloads after submitting the user details (or just when the page is loaded).

I came across this script that does the animation I want but requires the .click event. How could I change it so it will animate just when the page is loaded?

$("div").click(function () {
  $(this).effect("bounce", { times:3 }, 300);

});

Also does this effect work with the standard jquery library?

¿Fue útil?

Solución

$(document).ready(function(){
     $("#my_div").effect("bounce", { times:3 }, 300);
});

OR

$(window).load(function(){
   $("#my_div").effect("bounce", { times:3 }, 300);
});

Otros consejos

try something like this FIDDLE

$(function(){
    $("#my_div").effect("bounce", { times:3 }, 300);
})
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top