4 个回答
<div class='pre'></div>
先让div元素position:'绝对或相对定位'  到left:-100px(具体自己定)  
然后$(function(){
    $('.pre').addClass('move-left')
})
css:
.pre{
    width:100px;
    height:100px;
    background:blue;
    position:fixed;
    top:0;//离上面多少
    left:-100px;//到浏览器左边
    transition:left 2s;
    -moz-transition:left2s; /* Firefox 4 */
    -webkit-transition:left 2s; /* Safari and Chrome */
    -o-transition:left 2s; /* Opera */
}
.move-left{
    left:100px;
}

不知道你的 $ 是什么库,jQuery 和 Zepto 都没有 scrollTo 方法,只有 scrollTop 与 scrollLeft

document.getElementById( 'dha' ).scrollLeft = 200

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题