jQuery 当指向链接时应显示默认隐藏的 div
我有一个页面,其中默认隐藏了一些 div。我希望能够将用户指向一个显示 div 的链接。
前任。 https://app.emailsmsmarketing.com/login
用户可以点击“注册”来隐藏登录信息div 并显示寄存器 div。我想要完成的基本上是添加一个到主站点的链接,默认情况下用户可以从该站点访问注册表单(仅使用 jQuery)。
前任。 https://app.emailsmsmarketing.com/login#!register (或类似的内容)
基本上我要问的是:
a)可以做到这一点
b) 如果是这样,怎么办?
我不确定这对任何人是否有意义。我很感激所提供的任何帮助。
I have a page where there are a few divs hidden by default. I would like to be able to point users to a link where it would show the divs.
ex. https://app.emailsmsmarketing.com/login
Users are able to click "Register" which hides the login div and shows the register div. What I'm trying to accomplish is basically adding a link to the main site from where users will be able to access the registration form by default (using jQuery only).
ex. https://app.emailsmsmarketing.com/login#!register (or something like that)
Basically what I'm asking is:
a) is is possible to do this
b) if so, how?
I'm not sure if this makes sense to anyone. I appreciate any help provided.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以在
ready
事件期间检查document.location
属性:You can examine the
document.location
property duringready
event:您可能正在寻找这个:基于锚点的 URL 导航使用 jQuery
You probably looking for this: Anchor-based URL navigation with jQuery
当然,只需在链接上设置一个类或 id 或其他内容,如下所示:
然后在 jQuery 中执行此操作
其中 registerdiv 是隐藏 div 等的 ID。
Well sure, just set a class or id or something on your link, like so:
Then do this in jQuery
Where registerdiv is the ID of your hidden div etc.