<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Joydeep Dev Nath on Medium]]></title>
        <description><![CDATA[Stories by Joydeep Dev Nath on Medium]]></description>
        <link>https://medium.com/@joydeepdevnath?source=rss-7d59fb6898e7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*90o3681bCrTNWx6I-Q-Bwg.jpeg</url>
            <title>Stories by Joydeep Dev Nath on Medium</title>
            <link>https://medium.com/@joydeepdevnath?source=rss-7d59fb6898e7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 17:17:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@joydeepdevnath/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Creating a switchable Sign In form]]></title>
            <link>https://medium.com/@joydeepdevnath/creating-a-switchable-sign-in-form-7d6f1c9a4ccd?source=rss-7d59fb6898e7------2</link>
            <guid isPermaLink="false">https://medium.com/p/7d6f1c9a4ccd</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[web-design]]></category>
            <category><![CDATA[jquery]]></category>
            <dc:creator><![CDATA[Joydeep Dev Nath]]></dc:creator>
            <pubDate>Sat, 16 Feb 2019 21:53:56 GMT</pubDate>
            <atom:updated>2019-02-16T21:53:56.614Z</atom:updated>
            <content:encoded><![CDATA[<p>So today I was trying to create a Sign In page for a project. It suddenly occurred to me: <em>Why don’t I put Sign Up and Sign In forms into a single page, and make them switchable?</em> I remember seeing the concept somewhere, but I had never used it in any of my projects, so I decided to give it a try. Let’s get started.</p><h3><strong>What we’ll be creating</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/521/1*5IFBk15mS5aWxu1ERbCU9g.gif" /><figcaption>This is what we’re gonna create</figcaption></figure><h3><strong>What we’ll be using</strong></h3><p>Since this is going to be a web page, we’ll obviously be using HTML, CSS and JavaScript. In order to make things simpler and the animations easier, we’ll also use jQuery.</p><h3>First things first</h3><p>First off, let’s create the folders we require. We need a home directory which houses our index.html. This is the only HTML file we’re going to need for this project. Now we need directories for our CSS, JS and image files. Inside the home folder, create three folders-<strong> <em>css</em></strong>,<strong><em> js </em></strong>and <strong><em>images</em></strong>.</p><p>Inside the <strong><em>css </em></strong>folder create a file <strong><em>main.css</em></strong>. Similarly, inside the <strong><em>js</em></strong> folder create a file <strong><em>main.js</em></strong>. Also<strong><em> </em></strong>copy the jQuery library into the <strong><em>js </em></strong>folder. And finally download a JPG image, copy it to the <strong><em>images </em></strong>folder, and name it <strong><em>bg.jpg</em></strong>. Now we’re ready to begin.</p><h3>Creating the elements</h3><p>We’ll define the elements of our page using good ol’ HTML. Type out the HTML boilerplate, import css and js files and navigate to the body. Now, basically our body will have two outer div elements viz. grayBox and whiteBox . The grayBox contains passive elements, and the whiteBox contains the active elements. Here’s what the complete HTML will look like:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8858a4a96bc89004d4480d45c5592280/href">https://medium.com/media/8858a4a96bc89004d4480d45c5592280/href</a></iframe><p>Note that by default, when the page is loaded, the Sign In form is displayed and the Sign Up form is hidden. This is done using the inline CSS style=”display: none;” that has been added to signUpForm .</p><h3>Styling the elements</h3><p>Our elements have been defined but they are looking dull. To make them look better, and to tell the elements where we want them to be, we need to sprinkle some CSS. Let’s do just that.</p><p>First of all, we want the web page to occupy the complete device height available. To do this, we target the html selector. We set the height of html to 100vh and set the padding to 0. Also, we set the height of body to 100% .</p><pre>html {<br>    height: 100vh;<br>    padding: 0;<br>}</pre><pre>body {<br>    height: 100%;<br>    margin: 0;<br>    display: grid;<br>    align-items: center;<br>}</pre><p>Now, let’s add a background. Recall that we had downloaded a JPG and named it bg.jpg . That is what we’ll be using right now. Attach the ::before pseudo-element to body , and add the other required properties.</p><pre>body::before {<br>    content: &quot;&quot;;<br>    position: fixed;<br>    z-index: -1;<br>    height: 105vh;<br>    width: 105vw;<br>    top: -2.5vh;<br>    left: -2.5vw;<br>    display: block;<br>    background: url(https://medium.com/&#39;../images/bg.jpg&#39;);<br>    background-repeat: no-repeat;<br>    background-size: cover;<br>    filter: blur(2px);<br>}</pre><p>Note that we could’ve skipped the ::before pseudo-element, and added an extra outer element that would contain our background. It would still work the same. I decided to use ::before to avoid <em>polluting</em> the HTML.</p><p>The rest of the CSS rule-sets are pretty much self-explanatory. Here’s what the final CSS looks like:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2e3ec82a4e2742248d632eebd5c43715/href">https://medium.com/media/2e3ec82a4e2742248d632eebd5c43715/href</a></iframe><h3>Defining the interactions</h3><p>Now that we’re done with creating and styling our elements, it’s time we add interactions. Since we’ll be using jQuery, it’s gonna be pretty simple. We basically need only two interactions.</p><p>First, when we click the Sign Up button present in the passive grayBox , the Sign In form should disappear, and the Sign Up form should slide in.</p><p>Second, when we click the Sign In button present in the passive grayBox , the Sign Up form should disappear, and the Sign In form should slide in.</p><p>To achieve these, we listen for click events using jQuery’s on() event handler method. Here’s how it’s done.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e554921b1790de48e909efbb3be67262/href">https://medium.com/media/e554921b1790de48e909efbb3be67262/href</a></iframe><h3>And we’ve done it, together 😃</h3><p>We’ve successfully created a switchable form which will allow users to Sign Up/Sign In from a single web page. Now you’re ready to add your own modifications to it and use it on your next web project.</p><h3>External resources</h3><ol><li>GitHub repository containing the complete source code can be found <a href="https://github.com/DevNathJoydeep/SwitchableForm">here</a>.</li><li>Speedcoding video of this project can be found <a href="https://www.youtube.com/watch?v=8H22u8o8Qpw">here</a>.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d6f1c9a4ccd" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>