Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset=utf-8 />
- <title>ColorBox demo</title>
- <style type="text/css">
- *{
- box-sizing: border-box;
- }
- img{
- max-width:100%;
- }
- .popup{
- background: rgba(4, 4, 4, 0.5);
- padding: 50px 0px;
- position: fixed;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- /*opacity: 0;*/
- /*visibility: hidden;*/
- display:none;
- }
- .popup.active{
- opacity: 1;
- visibility: visible;
- }
- .container{
- width:1000px;
- margin: 0 auto;
- position:relative;
- }
- .arrow{}
- .arrow span{
- transition:all 0.5s;
- display: inline-block;
- }
- .arrow.active span{
- transform: rotate(180deg);
- }
- </style>
- </head>
- <body>
- <h1>Hello, there!</h1>
- <h2>This is some content</h2>
- <p>The popup will open in five seconds</p>
- <button id="button" >Popup</button>
- <div id="popup" class="popup">
- <div class="container">
- <button id="close">X</button>
- <div class="row">
- <img src="natur.jpg" alt="" />
- </div>
- </div>
- </div>
- <hr />
- <a class="lightbox" href="natur.jpg">Popup</a> | <a class="lightbox" href="trusticonscolor.png">Popup 2</a>
- <div id="lightbox-container" class="popup">
- <div class="container">
- <button class="close">X</button>
- <div class="row">
- <img class="image" src="" alt="" />
- </div>
- </div>
- </div>
- <hr />
- <button class="arrow">click <span>^</span></button>
- <hr />
- <div id="count">0</div>
- <ul id="countbox">
- </ul>
- <hr />
- <ul id="content">
- <li>List Content 1 <button class="add">+</button></li>
- <li>List Content 2 <button class="add">+</button></li>
- <li>List Content 3 <button class="add">+</button></li>
- <li>List Content 4 <button class="add">+</button></li>
- <li>List Content 5 <button class="add">+</button></li>
- <li>List Content 6 <button class="add">+</button></li>
- </ul>
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
- <script>
- $(document).ready(function() {
- $("#button").click(function() {
- //$("#popup").addClass("active");
- $("#popup").fadeIn();
- });
- $("#close").click(function() {
- //$("#popup").removeClass("active");
- $("#popup").fadeOut();
- });
- // Lightbox
- $(".lightbox").click(function(e) {
- e.preventDefault();
- var link = $(this).attr("href");
- $("#lightbox-container").find(".image").attr('src', link);
- $("#lightbox-container").fadeIn();
- });
- $(".close").click(function() {
- $("#lightbox-container").fadeOut();
- });
- // Arrow animation
- $(".arrow").click(function() {
- $(this).toggleClass("active");
- });
- // Add content
- var count = 0;
- $(".add").click(function() {
- var clone = $(this).parent().clone();
- $("#countbox").append(clone);
- $("#countbox").find("button").removeClass("add").addClass("remove").text("-");
- count = count+1;
- $("#count").text(count);
- });
- $("#countbox").on( 'click','.remove', function() {
- $(this).parent().remove();
- count = count-1;
- $("#count").text(count);
- });
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment