Create simple popup login and signup box with jQuery


Popup facebook login with jQuery
See Live Demo DownloadGitHub

Couple of days ago I got a question from Joydeep Dutta on one of my post. He asked about how to create popup login and signup form like in the website “zomato.com”. I looked at the popup box there and i really liked it. So i thought about recreating it from the scratch with my own style.
And Since i am lazy, i started looking for a simplest way to create this jQuery modal box for Popup Login and Signup. I searched for a simple and light jQuery plugins for modal dialog box to use for this demo.
While searching i came across lots of awesome jQuery plugins. And then i found “leanModal.js” which was exactly the plugin i was looking for. In this tutorial, i am going to teach you how to create simple Popup modal Dialog box for login and signup form using leanModal.js and HTML easily with little knowledge of javascript.
Let’s Get started

The HTML

Setting up the HTML head, Linking necessary files i am using “leanModal.js” as our jQuery Modal plugin and Font awesome for icons.
Modal Trigger – A login button, It will open the modal when clicked.

Modal Container (Popup Box)
Markup for Social Login Box, “Connect with Google” and “Connect with Facebook” boxes and Login and Signup buttons.
Markup for Login Form
Markup for Sign up Form

And the CSS

I am importing Google web fonts and using that font for the whole layout for this demo.
These are the styles for overlay and Popup box/Modal. Just copy the whole #lean_overlay styles as it is. You can modify the Popup box styles.
CSS styles for Buttons and 2 column grid that containers the login and Signup Button
Here are the styles for Rest of the modal box Modal header “popupHeader” and Modal body “popupBody”.
These are the styles for Social login boxes, the “Connect with Facebook” and “Connect with Google”.
And these are the styles for user login form, where users can login with their email address or username. By default the login form is hidden using “display: none” property.
These are the styles for the signup form, it pretty much uses the same styles as login form.

And the jQuery

Calling the modal through jQuery, insert the following codes inside the script tags.
And Showing or Hiding Forms when clicked on particular buttons.

If you want the Popup box/Modal to show when the page loads, use the Modified JS file “leanModal-modified-for-onload.js”. I have attached this file in the download as well.
I Hope you enjoyed the tutorial as much i did when writing it. Let me know if you found this helpful on the comments below. I’d love to hear your thoughts as well.

Comments

Popular posts from this blog

Script For Login, Logout and View Using PHP, MySQL and Bootstrap

Hyperledger Development with in 10 days — Day 6

Insert CheckBox and Radio button Data in MySQL Database Using PHP