1、新建一个.js文件fanhui.js,并保存到自己网站目录http://www.Vevb.com/wp-content/themes/twentyeleven/js代码如下:
- var isie6 = window.XMLHttpRequest ? false : true; function newtoponload() {
- var c = document.getElementByIdx_x_x(“full”); function b() {
- var a = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop; if (a > 0) {
- if (isie6) { c.style.display = “none”; clearTimeout(window.show); window.show = setTimeout(function () {
- var d = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop; if (d > 0) {
- c.style.display = “block”; c.style.top = (400 + d) + “px” } }, 300) } else { c.style.display = “block” } }
- else { c.style.display = “none” } } if (isie6) { c.style.position = “absolute” } window.onscroll = b; b() }
- if (window.attachEvent) { window.attachEvent(“onload”, newtoponload) }
- else { window.addEventListener(“load”, newtoponload, false) }
- document.getElementByIdx_x_x(“full”).onclick = function () { window.scrollTo(0, 0) };
2、将下面的代码复制到所用主题的footer.php文件,</body>标签之后、</html>标签之前的位置.
- <div id=”full” style=”width:50px; height:95px; position:fixed; left:49%; top:476px; margin-left:493px; z-index:100; text-align:center; cursor:pointer;”>
- <a><img src=”http://www.Vevb.com/wp-content/uploads/2013/01/fanhui.jpg” border=0 alt=”返回顶部”></a>
- </div>
- <script src=”http://www.Vevb.com/wp-content/themes/twentyeleven/js/fanhui.js” type=”text/javascript”>
- </script>
新闻热点
疑难解答
图片精选