免費論壇 繁體 | 簡體
公告:SCLUB雲端專屬主機己開放租用
分享
返回列表 下一主题 ›› ‹‹ 上一主题637 | 1 发帖

仿discuz返回顶部图片多样化

放第三方 或者header.htm 放最下面


  1. <style>
  2. #pam {
  3.         position: fixed;
  4.         display: none;
  5.         bottom: 4px;
  6.         height: 53px;
  7.         right: 4px;
  8.         width: 53px;
  9.         _position: absolute;
  10.         _top: expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||0)));
  11. }
  12. #pam .top_img {
  13.         display: block;
  14.         height: 34px;
  15.         width: 35px;
  16.         background: url("图片地址") no-repeat;
  17. }
  18. #pam .top_img:hover {
  19.         background-position: center bottom;
  20. }

  21. </style>
  22. <div id="pam" style="display: block;"><a class="top_img" href="#"></a></div>

  23. <script language="javascript"
  24. type="text/javascript">
  25. function
  26. getScroll(id){
  27. var obj =
  28. document.getElementById(id);
  29. var timer =
  30. null;
  31. positionFixed(obj);

  32. if(obj){
  33.   obj.style.display =
  34. 'none';
  35.   
  36. window.onscroll=function(){
  37.   
  38. getScrollTop() > 0 ? obj.style.display = "block" :
  39. obj.style.display = "none";
  40.   
  41. }
  42.   
  43. obj.onclick=function(){
  44.   
  45. var timer = setInterval(sMove,10);

  46.   function sMove(){

  47.    
  48. setScrollTop(getScrollTop() / 1.5);
  49.   
  50.   if(getScrollTop() <
  51. 1)clearInterval(timer);
  52.   
  53. }
  54.   
  55. }
  56. }
  57. }
  58. //判断IE6
  59. function
  60. positionFixed(obj){
  61. var iE6 = !-[1,] &&
  62. !window.XMLHttpRequest;
  63. if(obj){


  64. }
  65. }
  66. //获取滚动条Top
  67. function
  68. getScrollTop(){
  69. return document.documentElement.scrollTop
  70. || document.body.scrollTop;
  71. }
  72. //回到顶部
  73. function
  74. setScrollTop(value){
  75. document.documentElement.scrollTop =
  76. value;
  77. document.body.scrollTop =
  78. value;
  79. }
  80. window.onload = function(){

  81. getScroll('pam');
  82. };
  83. </script>
复制代码




  1. height: 34px;
  2.         width: 35px;
复制代码




这里调试自己上传图片大小



附件: 您需要登录才可以下载或查看附件。没有帐号?注册  
分享到: QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
欢迎来到9528虚拟世界分享圈!Http://9528.gain.tw
[无界]仿x系列之【返回顶部】

代码放在header.htm最下边即可


  1. <!--仿x3回顶部begin-->
  2. <script type="text/javascript">
  3. function goTopEx(){
  4.         var obj=document.getElementById("goTopBtn");
  5.         function getScrollTop(){
  6.                 return document.documentElement.scrollTop || document.body.scrollTop;
  7.             }
  8.         function setScrollTop(value){
  9.             if(document.documentElement.scrollTop){
  10.                     document.documentElement.scrollTop=value;
  11.                 }else{
  12.                     document.body.scrollTop=value;
  13.                 }
  14.                
  15.             }   
  16.         window.onscroll=function(){getScrollTop()>0?obj.style.display="":obj.style.display="none";
  17.                     var h=document.body.scrollHeight - getScrollTop() - obj.offsetTop - obj.offsetHeight;
  18.                     obj.style.bottom=0+"px";
  19.                     if(h<350){
  20.                         obj.style.bottom=340+"px";
  21.                         obj.style.top="auto";
  22.                     }

  23.         
  24.         }
  25.         obj.onclick=function(){

  26.             var goTop=setInterval(scrollMove,10);
  27.             function scrollMove(){
  28.                     setScrollTop(getScrollTop()/1.1);
  29.                     if(getScrollTop()<1)clearInterval(goTop);

  30.                 }
  31.         }
  32.     }

  33. function csfatie(){
  34. if (fid==0){
  35. showDialog("在这里不能发帖!")
  36. return false
  37. }
  38. location.href="/post.php?action=newthread&" + "fid=" + fid
  39. }
  40. </script>

  41. <div  id="scrolltop">
  42. <span><a onclick="csfatie()" class="replyfast" title="快速发帖"><b>快速发帖</b></a></span>
  43. <span><div style="bottom: 0px; display: none;" id="goTopBtn"><a title="返回顶部" class="scrolltopa"><b>返回顶部</b></a></div></span>
  44. <script type="text/javascript">goTopEx();</script>
  45. <span><a href="http://jiapinshuizu.imotor.com/index.php" hidefocus="true" class="returnlist" title="返回首页"><b>返回首页</b></a></span>
  46. </div>

  47. <style>
  48. #scrolltop {margin-left: 905px;left:50%;position: fixed;bottom: 100px;display: block;width: 40px;background: none repeat scroll 0% 0% #F4F4F4;border-width: 0px 1px 1px;border-style: none solid solid;border-color: #CDCDCD;border-image: none;border-radius: 3px;cursor: pointer;}
  49. #scrolltop a {display: block;width: 30px;height: 24px;padding: 3px 5px;line-height: 12px;text-align: center;color: #787878;text-decoration: none;background: url(http://www.bbvdd.com/d/20191208192913jv4.png) no-repeat scroll 0px 0px transparent;border-top: 1px solid #CDCDCD;}
  50. a.replyfast {background-position: 0px -30px !important;}
  51. a.replyfast:hover  {background-position: -40px -30px !important;}
  52. a.scrolltopa:hover {background-position: -40px 0px !important;}
  53. a.scrolltopa {background-position: 0px 0px !important;}
  54. a.returnlist {background-position: 0px -60px !important;}
  55. a.returnlist:hover {background-position: -40px -60px !important;}
  56. a.replyfast {background-position: 0px -30px !important;}
  57. #scrolltop a b {visibility: hidden;font-weight: normal;}
  58. </style>
  59. <!--仿x3回顶部end-->
复制代码

附件: 您需要登录才可以下载或查看附件。没有帐号?注册  
欢迎来到9528虚拟世界分享圈!Http://9528.gain.tw
返回列表 下一主题 ›› ‹‹ 上一主题637 | 1