jQuery无法正常工作。第一次工作

时间:2014-04-07 19:36:29

标签: javascript jquery html asp.net css

 <script type="text/javascript">
            $(document).ready(function () {
                $('#login-trigger').click(function () {
                    $('#login-content').toggleClass('loginPopup'); //Login popup. '#login-trigger' is login button
                    $('#blurr').css("opacity", "0.4"); //Make background fade. '#blurr' id of <div> containing whole background.
                })

                $('#LoginView_signup').click(function () {
                    $('#blurr').css("opacity", "0.4"); //Working on first click but not afterwards. '#LoginView_signup' is Login button id in final HTML
                })

                $('#blurr').click(function () {
                    $('#login-content').removeClass('loginPopup');
                    $('#LoginView_CreateUserWizard').removeClass('loginPopup').addClass('inactive'); //'LoginView_CreateUserWizard' is id of Create user pop up in final HTML
                    $('#blurr').css("opacity", "1");
                })                   
            });
        </script>

一切都很好。我正在使用褪色的背景弹出我的Signin,它在点击背景时隐藏起来。我的SignUp Popup有一点问题。 当我点击SignUp按钮(&#39; LoginView_signup&#39;)时,注册弹出窗口会显示褪色的背景,当我点击背景时它会隐藏起来。现在当我再次单击SignUp按钮时,SignUp弹出窗口会显示,但背景不会消失。

这是我的Asp.net代码:

<asp:LoginView ID="LoginView" runat="server">
  <AnonymousTemplate>
      <asp:UpdatePanel ID="UpdatePanel" runat="server" ChildrenAsTriggers="True">
         <ContentTemplate>
            <asp:Button ID="signup" runat="server" Text="Sign Up" OnClick="signup_Click" CssClass="myButton" /> //Final HTML id: 'LoginView_signup'
            <asp:CreateUserWizard ID="CreateUserWizard" runat="server" Visible="false" CssClass="loginPopup"> //Final HTML id: 'LoginView_CreateUserWizard'
               <WizardSteps>
                  <asp:CreateUserWizardStep ID="CreateUserWizardStep1" runat="server">
                  </asp:CreateUserWizardStep>
                  <asp:CompleteWizardStep ID="CompleteWizardStep1" runat="server">
                  </asp:CompleteWizardStep>
               </WizardSteps>
             </asp:CreateUserWizard>
           </ContentTemplate>
         </asp:UpdatePanel>
       </AnonymousTemplate>

代码背后:

 protected void signup_Click(object sender, EventArgs e)
        {
            CreateUserWizard.Visible = true;        
        }

0 个答案:

没有答案