Simple variable transparency back to top button

Original link:

Variable transparency returns to the top code. If you scroll down more than 1200 pixels, the transparency of the button will decrease, reducing visual interference and making it easier to browse the main content. Very intimate user experience, compatible with mainstream browsers

quote js
 <script src=""></script>


I modified a little bit in the original css, you can re-modify in the original code.

 .cd-top { z-index:9999; display: inline-block; border-radius: 3px; height: 38px; width: 38px; position: fixed; bottom: 40px; right: 10px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.05); /* image replacement properties */ overflow: hidden; text-indent: 100%; white-space: nowrap; background: rgba(232, 98, 86, 0.8) url( no-repeat center 50%; visibility: hidden; opacity: 0; -webkit-transition: all 0.3s; -moz-transition: all 0.3s; transition: all 0.3s; } { /* the button becomes visible */ visibility: visible; opacity: 0.85; } { /* the button becomes visible */ visibility: visible; background: #8BC34A url( no-repeat center 50%; opacity: 1; } { /* 如果用户继续向下滚动,这个按钮的透明度会变得更低*/ opacity: .5; } .no-touch .cd-top:hover { background-color: #e86256; opacity: 1; } @media only screen and (min-width: 768px) { .cd-top { right: 20px; bottom: 20px; } } @media only screen and (min-width: 1024px) { .cd-top { height: 38px; width: 38px; right: 30px; bottom: 30px; } }

 <a href="#0" class="cd-top">Top</a>


js is referenced in front of the tag of header.php
Add css to the style.css file
HTML added to header.php before the back of the tag


Originally, this button would be covered by other div modules.

How to set a DIV on the top of all layers, the top DIV is actually very simple, just use this style on this DIV,


This article is transferred from:
This site is only for collection, and the copyright belongs to the original author.