锚点定位
<div id="myId"></div>
<script>
let ids = "#myId";
if(ids){
const decoded = decodeURIComponent(ids);
const ele = document.getElementById(decoded);
if(ele){
//window.location.hash = decoded;//设置hash锚点(兼容浏览器)
ele.scrollIntoView({
behavior:'smooth',
block:'start',
})
}
}
</script>

浙公网安备 33010602011771号