单击登录按钮时如何防止页面向下移动?

Izu*_*rat 2 html css

单击此页面右上角的“登录”时:http : //dev-caal.gotpantheon.com/about,如果我单击“会员登录”,页面会移动,以便该框位于页。我怎样才能让页面停留在它最初的位置?

谢谢!

Dan*_*ill 5

您需要添加event.preventDefault()到 onclick 函数的开头。会员登录链接有一个锚链接,因此它会跳转到页面上锚链接的位置(至少看起来是这样)。