jq实现锚点跳转过渡
例子:当我们浏览页面想回到页面顶部时,点击按钮会回到想要去到的锚点。
1、数据内容(html)
<div id = "content">
<button onclick = "jumpToEx()">跳转</button>
<div class = "demoOne">
<ul>
<li></li>
......
</ul>
</div>
// 测试的位置
<div id = "demoTwo">
</div>
<div class = "demothree">
<ul>
<li></li>
......
</ul>
</div>
</div>
2、jq运用scrollTop来实现
<script>
// 立即执行函数
$(function(){
$("html,body").animate({
scrollTop : 0
}, 1000);
})
// 点击跳转
function jumpToEx(){
$("html,body").animate({
scrollTop : $('#demoTwo').offset().top
}, 1000);
}
</script>
问题:在框架之中怎么使用?浏览了一下说是vue可以用scrollIntoView()