2017-04-21 3 views
1

codepen에서 ASP.NET으로 프로젝트를 통합하는 중 문제가 있습니다. 프로젝트를 다운로드하고 원자에 테스트하는 동안 완벽하게 작동하지만 ASP.NET (복사 붙여 넣기)으로 전송하려고하면 작업이 중지되고 이동하지 않고 로그인/등록 사이를 전환합니다. 나는 ASP.NET에 익숙하다. 아마도 뭔가를 놓치고있다. 이중 경고에 녹색 경고가 나타난다. <html><body> 태그가 있을지도 모르지만, 나는 그것을 고치는 법을 모른다. 어떤 도움이라도 사전에 감사드립니다.ASP.NET에서 작동하지 않는 Codepen이 ASP.NET에서 작동하지 않습니다.

원래 codepen : Codepen Link

참고 : 나는 비 폐쇄 <에/추가되었다 만든 경우에만 편집> 요소 ASP.NET 날에 말했다 때문이다.

var $loginMsg = $('.loginMsg'), 
 
    $login = $('.login'), 
 
    $signupMsg = $('.signupMsg'), 
 
    $signup = $('.signup'), 
 
    $frontbox = $('.frontbox'); 
 

 
$('#switch1').on('click', function() { 
 
    $loginMsg.toggleClass("visibility"); 
 
    $frontbox.addClass("moving"); 
 
    $signupMsg.toggleClass("visibility"); 
 

 
    $signup.toggleClass('hide'); 
 
    $login.toggleClass('hide'); 
 
}) 
 

 
$('#switch2').on('click', function() { 
 
    $loginMsg.toggleClass("visibility"); 
 
    $frontbox.removeClass("moving"); 
 
    $signupMsg.toggleClass("visibility"); 
 

 
    $signup.toggleClass('hide'); 
 
    $login.toggleClass('hide'); 
 
}) 
 

 
setTimeout(function() { 
 
    $('#switch1').click() 
 
}, 1000) 
 

 
setTimeout(function() { 
 
    $('#switch2').click() 
 
}, 3000)
body{ 
 
    background: linear-gradient(141deg, #0fb8ad 0%, #1fc8db 51%, #2cb5e8 75%); 
 
    font-family: 'Roboto', sans-serif; 
 
} 
 

 
.container{ 
 
    /*border:1px solid white;*/ 
 
    width: 600px; 
 
    height: 350px; 
 
    position: absolute; 
 
    top:50%; 
 
    left:50%; 
 
    transform: translate(-50%, -50%); 
 
    display: inline-flex; 
 
} 
 
.backbox{ 
 
    background-color: #404040; 
 
    width: 100%; 
 
    height: 80%; 
 
    position: absolute; 
 
    transform: translate(0,-50%); 
 
    top:50%; 
 
    display: inline-flex; 
 
    border-radius: 15px; 
 
} 
 

 
.frontbox{ 
 
    background-color: white; 
 
    border-radius: 20px; 
 
    height: 100%; 
 
    width: 50%; 
 
    z-index: 10; 
 
    position: absolute; 
 
    right:0; 
 
    margin-right: 3%; 
 
    margin-left: 3%; 
 
    transition: right .8s ease-in-out; 
 
} 
 

 
.moving{ 
 
    right:45%; 
 
} 
 

 
.loginMsg, .signupMsg{ 
 
    width: 50%; 
 
    height: 100%; 
 
    font-size: 15px; 
 
    box-sizing: border-box; 
 
} 
 

 
.loginMsg .title, 
 
.signupMsg .title{ 
 
    font-weight: 300; 
 
    font-size: 23px; 
 
} 
 

 
.loginMsg p, 
 
.signupMsg p { 
 
    font-weight: 100; 
 
} 
 

 
.textcontent{ 
 
    color:white; 
 
    margin-top:65px; 
 
    margin-left: 12%; 
 
} 
 

 
.loginMsg button, 
 
.signupMsg button { 
 
    background-color: #404040; 
 
    border: 2px solid white; 
 
    border-radius: 10px; 
 
    color:white; 
 
    font-size: 12px; 
 
    box-sizing: content-box; 
 
    font-weight: 300; 
 
    padding:10px; 
 
    margin-top: 20px; 
 
} 
 

 
/* front box content*/ 
 
.login, .signup{ 
 
    padding: 20px; 
 
    text-align: center; 
 
} 
 

 
.login h2, 
 
.signup h2 { 
 
    color: #35B729; 
 
    font-size:22px; 
 
} 
 

 
.inputbox{ 
 
    margin-top:30px; 
 
} 
 
.login input, 
 
.signup input { 
 
    display: block; 
 
    width: 100%; 
 
    height: 40px; 
 
    background-color: #f2f2f2; 
 
    border: none; 
 
    margin-bottom:20px; 
 
    font-size: 12px; 
 
} 
 

 
.login button, 
 
.signup button{ 
 
    background-color: #35B729; 
 
    border: none; 
 
    color:white; 
 
    font-size: 12px; 
 
    font-weight: 300; 
 
    box-sizing: content-box; 
 
    padding:10px; 
 
    border-radius: 10px; 
 
    width: 60px; 
 
    position: absolute; 
 
    right:30px; 
 
    bottom: 30px; 
 
    cursor: pointer; 
 
} 
 

 
/* Fade In & Out*/ 
 
.login p { 
 
    cursor: pointer; 
 
    color:#404040; 
 
    font-size:15px; 
 
} 
 

 
.loginMsg, .signupMsg{ 
 
    /*opacity: 1;*/ 
 
    transition: opacity .8s ease-in-out; 
 
} 
 

 
.visibility{ 
 
    opacity: 0; 
 
} 
 

 
.hide{ 
 
    display: none; 
 
}
<!DOCTYPE html> 
 

 
<html xmlns="http://www.w3.org/1999/xhtml"> 
 
<head runat="server"> 
 
    <title>Login</title> 
 
    <meta name="viewport" content="width=device-width, initial-scale=1"/> 
 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script> 
 
    <link href='https://fonts.googleapis.com/css?family=Roboto:400,300,100' rel='stylesheet' type='text/css'/> 
 
    
 
    <link href="stylelogin.css" rel="stylesheet" /> 
 
    
 

 
</head> 
 

 
<body> 
 
    <body> 
 
    <form id="form1" runat="server"> 
 
      <div class="container"> 
 
    <div class="backbox"> 
 
     <div class="loginMsg"> 
 
     <div class="textcontent"> 
 
      <p class="title">Don't have an account?</p> 
 
      <p>Sign up to save all your graph.</p> 
 
      <button id="switch1">Sign Up</button> 
 
     </div> 
 
     </div> 
 
     <div class="signupMsg visibility"> 
 
     <div class="textcontent"> 
 
      <p class="title">Have an account?</p> 
 
      <p>Log in to see all your collection.</p> 
 
      <button id="switch2">LOG IN</button> 
 
     </div> 
 
     </div> 
 
    </div> 
 
    <!-- backbox --> 
 

 
    <div class="frontbox"> 
 
     <div class="login"> 
 
     <h2>LOG IN</h2> 
 
     <div class="inputbox"> 
 
      <input type="text" name="email" placeholder=" EMAIL"/> 
 
      <input type="password" name="password" placeholder=" PASSWORD"/> 
 
     </div> 
 
     <p>FORGET PASSWORD?</p> 
 
     <button>LOG IN</button> 
 
     </div> 
 

 
     <div class="signup hide"> 
 
     <h2>SIGN UP</h2> 
 
     <div class="inputbox"> 
 
      <input type="text" name="fullname" placeholder=" FULLNAME"/> 
 
      <input type="text" name="email" placeholder=" EMAIL"/> 
 
      <input type="password" name="password" placeholder=" PASSWORD"/> 
 
     </div> 
 
     <button>SIGN UP</button> 
 
     </div> 
 

 
    </div> 
 
    <!-- frontbox --> 
 
    </div> 
 
    </form> 
 
</body> 
 

 
</html> 
 
    
 

 
    <script src="jslogin.js"></script> 
 
</body> 
 
</html>

+0

asp.net에서 어디에서 Jquery 코드를 호출하고 있습니까? – Webruster

+0

먼저 앞에있는 두 번째 과을 제거한 다음 브라우저가 디버그 콘솔 (F12)에 표시 할 오류를 알려주십시오. – Booster2ooo

+0

@Webruster 나는 그것을 codepen (링크를 보시오)에서 복사 한 것으로 알고 있지 않다. –

답변

1

그것을 시도 할 필요가 없습니다 jQuery를 트리거하는 일을 피하기 위해 기능 e.preventDefault을 추가.

$('#switch1').on('click', function (e) { 
    e.preventDefault(); 
    $loginMsg.toggleClass("visibility"); 
    $frontbox.addClass("moving"); 
    $signupMsg.toggleClass("visibility"); 

    $signup.toggleClass('hide'); 
    $login.toggleClass('hide'); 
}) 

$('#switch2').on('click', function (e) { 
    e.preventDefault(); 
    $loginMsg.toggleClass("visibility"); 
    $frontbox.removeClass("moving"); 
    $signupMsg.toggleClass("visibility"); 

    $signup.toggleClass('hide'); 
    $login.toggleClass('hide'); 
}) 

나는 그래서 그것을 확인 코드에 그것을 시도하고 작동 여부를 있으면 알려 주시기 바랍니다이 jsFiddle이 작업을 얻었다.

희망이 있으면 도움이됩니다.

+0

고마워요,이 작품! 고맙습니다! –

관련 문제