How to make a lightbox with CSS and jQuery?

Asked

Viewed 598 times

0

I’m looking to make a bar of login with lightbox, that is, when you click on link "enter the website" a <div> that was hidden and a transparent dark background will appear.

How do you build something like this?

  • I’m reopening because the principles for doing this are very simple, and can be quietly explained in an answer.

1 answer

1


Matheus, you can use Bootstrap:

HTML

<div class="container">
    <div class="row">
        <a class="btn btn-primary" data-toggle="modal" href="#meuLoginModal" >Login</a>

        <div class="modal hide" id="meuLoginModal">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal">x</button>
            <h3>Meu Login</h3>
          </div>
          <div class="modal-body">
            <form method="post" action='' name="login_form">
              <p><input type="text" class="span3" name="eid" id="email" placeholder="Email"></p>
              <p><input type="password" class="span3" name="passwd" placeholder="Senha"></p>
              <p><button type="submit" class="btn btn-primary">Entrar</button>
                <a href="#">Esqueceu a senha?</a>
              </p>
            </form>
          </div>
          <div class="modal-footer">
            Novo aqui?
            <a href="#" class="btn btn-primary">Registrar</a>
          </div>
        </div>
    </div>
</div>

Javascript

<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>

JSFIDDLE

  • 1

    thanks a lot guy thanks for the help

Browser other questions tagged

You are not signed in. Login or sign up in order to post.