我有下面的代码,如果您在页面上使用类似于这个#dashboard的哈希标签和文本,它应该在#whatever上登陆并滚动到加载该部分的任何地方。
$(document).ready(function() {
// *only* if we have anchor on the url
if (window.location.hash) {
var hashname = $(window.location.hash);
// smooth scroll to the anchor id
$('html, body').animate({
在我的应用程序中,我的登陆页面上有loginButtons。我希望用户在成功登录后被自动重定向到/home路由。
这段代码似乎实现了这一点:
// Redirect to /home after logging in
Accounts.onLogin(function() {
Router.go("/home");
});
// Make sure the user is logged in when accessing other routes
Router.onBeforeAction((function() {
if (!Meteor.userId() &