Using JS to generate the blog directory and CSS custom blogging _javascript Skills

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.