Shake a login form on error

前端 未结 9 1202
猫巷女王i
猫巷女王i 2020-12-21 02:39

I have successfully built a login form using ajax and want to add a shake effect to the form when the user enters incorrect details. I have the function in place that will f

9条回答
  •  清歌不尽
    2020-12-21 03:18

    I have made a plugin for this .. check it http://static.mbiosinformatica.com.br/jQuery/

    Is it working in IE ( 7 , 8 , 9 ) , Chrome and Firefox.

    And, you can apply a callback function, to show error message .. or anything else.

    $('#div').shake({
          positions : { 'L' : 50 , 'R' : 50 } , // shake only left and right (U,L,R,D)
          rotate : false , // rotate div on shake .. true/false
          parent : false  // shake parent div .. true/false
    }, function(){ /* do something */ });
    

    In the positions, you can send array too, just: positions: [ [ 'L', 50 ... ] ] This value '50' its the shake distance from original position ..


    To change timeout ( delay ) and effect duration, you have to set timeout: [you timeout .. / delay ] and the effect times .. interval: ...

提交回复
热议问题