The example of this article introduces the use of JS to generate blog directory and CSS Custom blog methods, share for everyone to reference, the specific content as follows
1.JS Code
Want to generate a directory, many say need JS Modify permissions, that here directly into the Settings page, to find the contact below the mail directly sent on the line, the staff reply is very fast.
After the permission, the following is to write (search) of the JS code in the Footer HTML code box, and then click to save on it. It is important to note that the generation of the catalog is a few levels of headings. JS code as follows, basically no change, copy the original author's writing, you can generate level two directory, respectively, for H2 and H3, this need attention.
In combination, this directory has the following characteristics, which can be seen in this article (level two directory this blog is not used).
1. You can generate a level two directory in your blog header
2. There is a link to the top above each level of the directory
JS code is as follows.
<script language= "javascript" type= "Text/javascript" >//generating Level two directory index list function generatecontentlist () {var maincont
ent = $ (' #cnblogs_post_body '); var h2_list = $ (' #cnblogs_post_body H2 ');
If your chapter title is not H2, just replace the H2 here if (Maincontent.length < 1) return;
if (h2_list.length>0) {var content = ' <a name= ' _labeltop ' ></a> ';
Content = = ' <div id= ' navcategory ' > ';
Content + = ' <p style= ' font-size:18px ' ><b> directory </b></p> ';
Content + = ' <ul> '; for (var i=0 i
2. First level title CSS format
I'm looking at some of Zzq's blog posts with a light gray background that looks good when added. Here to borrow the picture as a first-level title background, pictures and CSS descriptions are as follows.
#cnblogs_post_body h2 {
background-repeat:no-repeat;
Background-image:url (' http://xxxx ');
}
The above is the detailed content of this article, I hope to help you learn.