1, the first step http://jquery.lukelutman.com/plugins/pseudo/download Jq-pseudo.js download, the introduction of jquery and Jq-pseudo.js2, the writing selector syntax:
selector: Before, selector {
/* Compatible with IE6, ie7*/
Before: ' What to write ';
/* Compatible with ie8*/
Content: ' What to write ';
}to set the style of a pseudo-element:selector: Before, selector. Before {
Writing style
}Demo
1 <!DOCTYPE HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd ">2 <HTML>3 <Head>4 <title>Basic example-jquery Pseudo Plugin</title>5 <Scripttype= "Text/javascript"src= "Jquery.js"></Script>6 <Scripttype= "Text/javascript"src= "Jquery.pseudo.js"></Script>7 <Scripttype= "Text/javascript">8 $(function(){9 $('#on'). Bind ('Click', function(e) {Ten $('Body'). addclass ('Toggle'); One E.preventdefault (); A }); - $('#off'). Bind ('Click', function(e) { - $('Body'). Removeclass ('Toggle'); the E.preventdefault (); - }); - }); - </Script> + <styletype= "Text/css"> - + P:before, P{ A before:' foo '; at content:' foo '; } - - P:after, P{ - After:' Bar '; - content:' Bar '; } - in P:before, p. Before{ - Color:Blue; } to + P:after, p. after{ - Color:Red; } the * </style> $ </Head>Panax Notoginseng <Body> - <H1>Basic example-jquery Pseudo Plugin</H1> the <P>« <ahref= "Index.html">Back to the JQuery Pseudo Plugin</a></P> + <P>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqu A. Ut enim ad minim veniam, quis nostrud exercitation Ullamco laboris nisi Ut aliquip ex ea commodo consequat. Duis aute irure dolor in Reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur Sint Occaecat Cupidatat non proident, sunt in culpa qui officia deserunt mollit anim ID est laborum.</P> A <P>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqu A. Ut enim ad minim veniam, quis nostrud exercitation Ullamco laboris nisi Ut aliquip ex ea commodo consequat. Duis aute irure dolor in Reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur Sint Occaecat Cupidatat non proident, sunt in culpa qui officia deserunt mollit anim ID est laborum.</P> the <P>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqu A. Ut enim ad minim veniam, quis nostrud exercitation Ullamco laboris nisi Ut aliquip ex ea commodo consequat. Duis aute irure dolor in Reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur Sint Occaecat Cupidatat non proident, sunt in culpa qui officia deserunt mollit anim ID est laborum.</P> + </Body> - </HTML>
IE7 compatible with After, before methods