最简单的层随滚动条滚动

  在网上看了好多关于层随滚动条滚动的文章,感觉不是太理想。就自己试着写了个。
  JS部分只需要这两行就可以三行就OK了。其中的Top 200px等属性根据自己的需要设置,可以设成margin等属性。具体就不写了。

<SCRIPT LANGUAGE=”JavaScript”>
<!–
 function gun(){
 document.getElementById(‘gdt’).style.top=document.documentElement.scrollTop+’px’;
 }
 setInterval(“gun()”,500);
//–>
</SCRIPT>

  特别说明:document.documentElement.scrollTop 关于scrollTop的使用,请到本博客《滚动条的位置:scrollTop的使用》一节查看详细。


( ! ) Warning: Missing argument 1 for cwppos_show_review(), called in /data/www/enjoyphp/wp-content/themes/flat/content-single.php on line 29 and defined in /data/www/enjoyphp/wp-content/plugins/wp-product-review/includes/legacy.php on line 18
Call Stack
#TimeMemoryFunctionLocation
10.0001355192{main}( ).../index.php:0
20.0001355480require( '/data/www/enjoyphp/wp-blog-header.php' ).../index.php:17
30.217210162240require_once( '/data/www/enjoyphp/wp-includes/template-loader.php' ).../wp-blog-header.php:19
40.218510233384include( '/data/www/enjoyphp/wp-content/themes/flat/single.php' ).../template-loader.php:74
50.299310812544get_template_part( ).../single.php:5
60.299310813064locate_template( ).../general-template.php:167
70.299310813160load_template( ).../template.php:643
80.299410813544require( '/data/www/enjoyphp/wp-content/themes/flat/content-single.php' ).../template.php:686
90.305410800040cwppos_show_review( ).../content-single.php:29

发表评论

电子邮件地址不会被公开。 必填项已用*标注