╃巡洋艦㊣ 2011-11-26 22:36:30 4254次浏览 8条回复 0 0 0

<a href="#" id="top">回到顶部</a> CSS代码,使用了fixed让对象固定于浏览器窗口: #top{position:fixed;bottom:0;right:10px;} jQuery代码,注意正常使用的几个条件: $('#top').click(function(){$('html,body').animate({scrollTop: '0px'}, 800);return false;}); 800 是调节移动速度的,可以自己调节!

  • 回复于 2011-11-27 10:59 举报

    {:2_31:}谢谢舰长分享~~

  • 回复于 2011-11-27 23:10 举报

    不错,学习啦:D 11初的时候在网上找这代码找了两天:'(

  • 回复于 2011-11-28 09:27 举报

    position:fixed; ie6无效的,舰长再贴个针对ie6的js代码吧 :lol

  • 回复于 2011-11-28 10:52 举报

    我是小白,麻烦和尚再这个问题再完善一下!

  • 回复于 2011-11-29 09:43 举报
    #top {
        position: absolute;
        bottom: auto;
        top: expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-  this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)|| 100)- (parseInt(this.currentStyle.marginBottom,10)||232)));
    }
    

    给你一个简单的,js你自己写吧,我就不给你写了

  • 回复于 2011-11-29 09:48 举报

    CSS中的expression兼容各种浏览器吗?

  • 回复于 2012-05-16 17:59 举报

    真是强大的啊。。。。前端搞的不丑啊。。。。

  • 回复于 2012-05-16 20:55 举报

    额,我记得貌似有个很简单很简单的。。。具体不记得。。。这样貌似可以吧。。

    点击

您需要登录后才可以回复。登录 | 立即注册