JS Code of "Back to Top" and "write comments" on the inner page

Source: Internet
Author: User
I did it again according to the method described at the first level, but it didn't have any effect. Is it my template? Think twice about it. However, the method is good and the effect is remarkable. Let's analyze it here. One thing to note: This JS special effect is not original. It was actually seen during a visit to Lu songsong's blog yesterday. It feels pretty good. Use SyntaxHighlighter. all ();


I did it again according to the method described at the first level, but it didn't have any effect. Is it my template? Think twice about it. However, the method is good and the effect is remarkable. Let's analyze it here.
One thing to note: This JS special effect is not original. It was actually seen during a visit to Lu songsong's blog yesterday. It feels good. It will be helpful to increase the interaction heat of blogs in the future, so we transplanted it. The color of the image has been adjusted, and the positioning parameters in the JS file have also been re-tuned. It looks good and suits my topic. Let's share it today. If you use this green topic, you can add it directly in the following tutorial.
Step 1: Save the following code as a JS file and name it yourself, for example, "fudong. js"
JavaScript code
LastScrollY = 0;
Function heartBeat (){
Var diffY;
If (document.doc umentElement & document.doc umentElement. scrollTop)
DiffY = document.doc umentElement. scrollTop;
Else if (document. body)
DiffY = document. body. scrollTop
Else
{/* Netscape stuff */}
Percent =. 1 * (diffY-lastScrollY );
If (percent> 0) percent = Math. ceil (percent );
Else percent = Math. floor (percent );
Document. getElementById ("full"). style. top = parseInt (document. getElementById ("full"). style. top) + percent + "px ";
LastScrollY = lastScrollY + percent;
/* If (diffY = 0) {document. getElementById ("full"). style. display = "none "}
Else {document. getElementById ("full"). style. display = "block "}
}*/
If (diffY> 450) {document. getElementById ("full"). style. display = "block "}
Else {
Document. getElementById ("full"). style. display = "none "}
}

Suspendcode ="

"
Document. write (suspendcode );
Window. setInterval ("heartBeat ()", 1 );


Since the above special effect belongs to three connections, you can change the code if you want to remove the "Homepage" from the top, homepage, and bottom pages:
JavaScript code

Align: center;>
Src = ../THEMES/loker_cms/style/images/btn_top.gif border = 0/>

Step 2: Upload the JS file to the SCRIPT directory under the topic package;
Step 3: Upload the two required images btn_top.gif?btn_comment.gif to the/style/images/directory under the topic package;
Step 4: Go to the background and edit and modify the "./THEMES/topic package ID/TEMPLATE/single.html" file under the topic package."Area, insert JS call code
JavaScript code

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.