Line 1: | Line 1: | ||
<html> | <html> | ||
+ | <head> | ||
+ | <style type="text/css"> | ||
+ | #float_banner { | ||
+ | position: absolute; | ||
+ | top: 0; | ||
+ | left: 0; | ||
+ | width: 50px; | ||
+ | height: 500px; | ||
+ | line-height: 30px; | ||
+ | text-align: left; | ||
+ | background: #000; | ||
+ | color: #fff; | ||
+ | font-size: 14px; | ||
+ | font-weight: bold; | ||
+ | z-index: 2; | ||
+ | } | ||
+ | </style> | ||
+ | </head> | ||
<body> | <body> | ||
<div class="header-container"> | <div class="header-container"> | ||
Line 87: | Line 105: | ||
</nav> | </nav> | ||
</div> | </div> | ||
+ | <div id="float_banner"></div> | ||
+ | <script language="javascript"> | ||
+ | var speed = 100; | ||
+ | var scrollTop = null; | ||
+ | var hold = 0; | ||
+ | var float_banner; | ||
+ | var pos = null; | ||
+ | var timer = null; | ||
+ | var moveHeight = null; | ||
+ | float_banner = document.getElementById("float_banner"); | ||
+ | window.onscroll = scroll_ad; | ||
+ | |||
+ | function scroll_ad() { | ||
+ | scrollTop = document.documentElement.scrollTop + document.body.scrollTop; | ||
+ | pos = scrollTop - float_banner.offsetTop; | ||
+ | pos = pos / 10 | ||
+ | moveHeight = pos > 0 ? Math.ceil(pos) : Math.floor(pos); | ||
+ | if (moveHeight != 0) { | ||
+ | float_banner.style.top = float_banner.offsetTop + moveHeight + "px"; | ||
+ | setTimeout(scroll_ad, speed); | ||
+ | } | ||
+ | //alert(scrollTop); | ||
+ | } | ||
+ | </script> | ||
</body> | </body> | ||
</html> | </html> |
Revision as of 08:59, 10 October 2018