Jquery returns the Top effect code

Source: Internet
Author: User
Tip: you can modify some code before running

<!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><title>Chinese webmaster sky-webpage special effects-comprehensive special effects-effect of "back to top" on Sina waves</title><meta http-equiv="content-type" content="text/html;charset=gb2312"><!--把下面代码加到<head>与</head>之间--><style type="text/css">. BackToTop {display: none; width: 18px; line-height: 1.2; padding: 5px 0; background-color: #000; color: # fff; font-size: 12px; text-align: center; position: fixed; _ position: absolute; right: 10px; bottom: 100px; _ bottom: "auto"; cursor: pointer; opacity :. 6; filter: Alpha (opacity = 60 );}</style><script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js" type="text/javascript"></script></head><body>An error is prompted in the lower left corner of the preview result, and the effect is invisible. Refresh the page to see the effect. Of course, this problem does not occur in actual use.<br><div ></div><!--把下面代码加到<body>与</body>之间--><script type="text/javascript">(Function () {var $ backToTopTxt = "back to top", $ backToTopEle = $ ('<div class="backToTop"></div>'). AppendTo ($ ("body ")). text ($ backToTopTxt ). attr ("title", $ backToTopTxt ). click (function () {$ ("html, body "). animate ({scrollTop: 0}, 120) ;}, $ backtopfun = function () {var st = $ (document ). scrollTop (), winh = $ (window ). height (); (st> 0 )? $ BackToTopEle. show (): $ backToTopEle. hide (); // locate if (! Window. XMLHttpRequest) {export backtotopele.css ("top", st + winh-166) ;};$ (window ). bind ("scroll", $ backToTopFun); $ (function () {$ backtopfun ();});})();</script></body></html>
Tip: you can modify some code before running

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.