我使用$anchorScroll
滚动到页面顶部,其中html元素的ID为#brand
。
<body>
<header id="brand">
<!--Content-->
</header>
</body>
AngularJS代码:
$location.hash("brand");
$anchorScroll();
然而,经过$anchorScroll
运行时,该页面的网址将成为http://localhost:8080/##brand
,这意味着##brand
被附加到原始URL。如何在使用$anchorScroll
时保留原始网址?提前致谢!
谢谢。有用! – NMSL
谢谢!为我节省了时间。 – CENT1PEDE