wp_shake_js

The WordPress Core wp shake js function.

Description

wp_shake_js(); 

Usage

  1. if ( !function_exists( 'wp_shake_js' ) ) { 
  2. require_once '/wp-login.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wp_shake_js(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-login.php  
  1. function wp_shake_js() { 
  2. ?> 
  3. <script type="text/javascript"> 
  4. addLoadEvent = function(func) {if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function') {wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function() {oldonload();func();}}}; 
  5. function s(id, pos) {g(id).left=pos+'px';} 
  6. function g(id) {return document.getElementById(id).style;} 
  7. function shake(id, a, d) {c=a.shift();s(id, c);if(a.length>0) {setTimeout(function() {shake(id, a, d);}, d);}else{try{g(id).position='static';wp_attempt_focus();}catch(e) {}}} 
  8. addLoadEvent(function() { var p=new Array(15, 30, 15, 0, -15, -30, -15, 0);p=p.concat(p.concat(p));var i=document.forms[0].id;g(i).position='relative';shake(i, p, 20);}); 
  9. </script> 
  10. <?php