- Have 5 pages
- Each page has a link for "Sign-in/Log-in" on the topbar
- Lets say user is on "HomePage" and he clicks "Log-in" button on the topbar
- I want "Homepage" to go in background (opacity=0.2) and put the "Log-in" pop-up in front (z-index: 100)
- Same behavior is expected for all 5 pages -
我所做的是:
-----------------Page 1----------
div.HomePage
div.accountPage
-----------------Page 2----------
div.BrowsePage
div.accountPage
-----------------Page 3----------
...
然后我在运行时使用javascript设置opaqueness和z-index属性。我在HTML / jade中为每个主页重复了accountPage的代码5次,并且javascript代码对于这种方法看起来并不干净。
- What I want is to create a TOTALLY SEPARATE "accountPage",
- Display on it click of "Login" button.
- Find out which of the 5 main pages user was on **/* This I dont know how to do */**
- Set that main page to background with opacity = 0.2
- Popup the accountPage for Login in front.
- After Login or cancel, bring the main page (user was on), back to focus
请帮忙。
答案 0 :(得分:0)
这听起来像是iframe或基于ajax的模态弹出窗口的完美候选者。 jQuery有很多可用... colorbox恰好是我最喜欢的。
以下是colorbox的工作原理:
<a href="/Sign-in/Log-in?returnUrl=[INSERT CURRENT URL HERE]" class="modal">Sign-in</a>
(注意:这可以使用window.location.href
以编程方式完成,这样您就不必将当前网址硬编码到每个链接中。)