Implementing Twitter like Login using Jquery and CSS.
💻 coding

Implementing Twitter like Login using Jquery and CSS.

1 min read 151 words
1 min read
ShareWhatsAppPost on X
  • 1The article explains how to create a Twitter-like login effect using jQuery and CSS with minimal code.
  • 2It demonstrates the use of jQuery's hide() and show() methods to manage the visibility of a sign-in box.
  • 3The provided code includes HTML for the sign-in link and form, along with CSS for styling the sign-in box.

AI-generated summary · May not capture all nuances

Key Insight
AskGif

"The article explains how to create a Twitter-like login effect using jQuery and CSS with minimal code."

Implementing Twitter like Login using Jquery and CSS.

In this post, I want to explain "Twitter-like login hide and show the effect with jquery and CSS ". Very simple just five lines of code using jquery hide() and show() events and little CSS code, use it and enrich your web projects.

Javascript Code

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/
libs/jquery/1.3.0/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{

$(".sign_in").click(function()
{
$("#sign_box").show();
return false;
});
$("body #main").click(function()
{
$("#sign_box").hide();
return false;
});
});
</script>

HTML Code

$('.sign_in').click(function(){} - sign_in is the class name of anchor 'Sign In'. Using show() event displaying the id="sign_box".

<div><a href="#" class="sign_in">Sign In</a></div>
<div id="sign_box">
<form method="post" action="">
<label>UserName
<input type="text" name="usr"/></label>
<label>Password
<input type='password' name="pwd"/></label>
<input type="submit" value=" Sing In "/>
</form></div>
<div id='main'><h1>www.askgif.info</h2></div>

CSS code

Contains CSS code just find out position:absolute

#sign_box
{
width:170px; 
background-color:#fff; 
border:solid 1px #5ea0c1; 
padding:8px;
position:absolute;
display:none;
-moz-border-radius-topright:6px;
-moz-border-radius-bottomleft:6px;
-moz-border-radius-bottomright:6px;
-webkit-border-top-right-radius:6px;
-webkit-border-bottom-left-radius:6px;
-webkit-border-bottom-right-radius:6px;
}
.sign_in
{
background-color:#FFFFFF;
border:solid 1px #5ea0c1;
padding:6px;
}
#main
{
height:500px;
}

Enjoyed this article?

Share it with someone who'd find it useful.

ShareWhatsAppPost on X

AskGif

Published on 30 August 2019 · 1 min read · 151 words

Part of AskGif Blog · coding

You might also like