Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added eye symbol and it's functionality #802

Merged
merged 1 commit into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions assets/css/addremove.css
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,30 @@ button:hover {
border: 1px solid var(--light-gray);
border-radius: 3px;
}
.input-box{
position: relative;
}

#eye-icon {
position: absolute;
top: 50%;
right: 10px;
transform: translateY(-50%);
padding: 5px;
border-radius: 50%;
cursor: pointer;
transition: all 0.3s;
z-index: 1;
height: 20px;
width: 25px;
}

#eye-icon-login {
position: absolute;
top: 50%;
right: 10px;
transform: translateY(-50%);
cursor: pointer;
height: 20px;
width: 25px;
}
42 changes: 40 additions & 2 deletions assets/html/addremovebook.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,19 @@ <h1>Your Booklist for Swapping</h1>
<div id="auth">
<h2>Login</h2>
<input type="text" id="login-username" placeholder="Username">
<input type="password" id="login-password" placeholder="Password">
<div class="input-box">
<input type="password" id="login_password" placeholder="Password">
<img src="../images/eye-close.png" alt="Eye close-image" id="eye-icon-login">
</div>
<button onclick="login()">Login</button>


<h2>Sign Up</h2>
<input type="text" id="signup-username" placeholder="Username">
<input type="password" id="signup-password" placeholder="Password">
<div class="input-box">
<input type="password" id="password" placeholder="Password">
<img src="../images/eye-close.png" alt="Eye close-image" id="eye-icon">
</div>
<button onclick="signUp()">Sign Up</button>
</div>

Expand All @@ -36,5 +42,37 @@ <h2>Welcome, <span id="user"></span></h2>
</div>
</div>
<script src="/assets/js/addremove.js"></script>
<script>
let eyeIcon = document.getElementById("eye-icon");
let password = document.getElementById("password");
let passwordLogin = document.getElementById("login_password");
let eyeIconLogin = document.getElementById("eye-icon-login");
// Set the password field to type "password" by default
password.type = "password";
eyeIcon.src = "../images/eye-close.png"; // Set the initial eye icon as closed

eyeIcon.onclick = function () {
if (password.type === "password") {
password.type = "text";
eyeIcon.src = "../images/eye-open.png";
} else {
password.type = "password";
eyeIcon.src = "../images/eye-close.png";
}
};

passwordLogin.type = "password";
eyeIconLogin.src = "../images/eye-close.png"; // Set the initial eye icon as closed

eyeIconLogin.onclick = function () {
if (passwordLogin.type === "password") {
passwordLogin.type = "text";
eyeIconLogin.src = "../images/eye-open.png";
} else {
passwordLogin.type = "password";
eyeIconLogin.src = "../images/eye-close.png";
}
};
</script>
</body>
</html>
Loading