- <script type="text/javascript">
- window.onscroll = function() //吸顶
- {
- var a = document.body.scrollTop + document.documentElement.scrollTop;
- if (a > 240) {
- document.getElementById("window-head").style.display = "block";
- } else {
- document.getElementById("window-head").style.display = "none";
- }
- }
- </script>
- //该片段来自于http://www.codesnippet.cn/detail/1808201410192.html
来源: http://www.codesnippet.cn/detail/1808201410192.html