Implementation of special effects on jQuery shaking layer and special effects on jquery shaking Layer
This article describes how to implement the special effects of jQuery shaking layer. Share it with you for your reference. The specific implementation method is as follows:
Copy codeThe Code is as follows:
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html;" charset = "UTF-8"/>
<Title> jQuery shake layer </title>
<Style type = "text/css">
Body {font: 12px Georgia, serif ;}
A {text-decoration: none ;}
# Header {margin: 50px auto}
# Header p {text-align: center; font-size: 16px; font-weight: bold}
# Box {width: 400px; height: 200px; background-color: # ccc; text-align: center}
</Style>
<Script type = "text/javascript" src = "js/jquery-1.6.2.min.js"> </script>
<Script type = "text/javascript">
Var box_left = 0;
$ (Document). ready (function (){
Box_left = ($ (window). width ()-$ ('# box'). width ()/2;
Detail ('character box,character footer'character .css ({'left': box_left, 'position': 'absolute '});
});
Function shock ()
{
For (I = 1; I <7; I ++)
{
$ ('# Box'). animate ({
'Left': '-= 15'
}, 3, function (){
$ (This). animate ({
'Left': '+ = 30'
}, 3, function (){
$ (This). animate ({
'Left': '-= 15'
}, 3, function (){
$ (This). animate ({
'Left': box_left
}, 3, function (){
// Shock end
});
});
});
});
}
}
</Script>
</Head>
<Body>
<Div id = "header">
<P> shake a layer when a wp background logon error occurs. </p>
</Div>
<Div id = "box"> <a href = "#" onclick = "shock (); return false;"> click I to view results </a> </div>
</Body>
</Html>
I hope this article will help you with jQuery programming.