PG | css popup

HTML
<!--popup--> <div class="popup-wrapper" id="popup"> <div class="popup-container"> <button class="popup-close" style="cursor: pointer;">X</button> <div class="popup-wrapper" id="popup"> <div class="popup-container"> <a href="#"> <img src="http://www.relatably.com/q/img/blank-quotes/blank-quotes-8.jpg"> </a> </div> </div> </div> </div> <!--popup-->
CSS
/* style untuk link popup */ button.popup-link { padding:17px 0; text-align: center; margin:10% auto; position: relative; width: 300px; color: #fff; text-decoration: none; background-color: #FFBA00; border-radius: 3px; box-shadow: 0 5px 0px 0px #eea900; display: block; } button.popup-link:hover { background-color: #ff9900; box-shadow: 0 3px 0px 0px #eea900; -webkit-transition:all 1s; transition:all 1s; } /* end link popup*/ /* animasi popup */ @-webkit-keyframes autopopup { from {opacity: 0;margin-top:-200px;} to {opacity: 1;} } @-moz-keyframes autopopup { from {opacity: 0;margin-top:-200px;} to {opacity: 1;} } @keyframes autopopup { from {opacity: 0;margin-top:-200px;} to {opacity: 1;} } /* end animasi popup */ /*style untuk popup */ #popup { background-color: rgba(0,0,0,0.5); position: fixed; top:0; left:0; right:0; bottom:0; margin:0; -webkit-animation:autopopup 2s; -moz-animation:autopopup 2s; animation:autopopup 2s; z-index: 999999999; } #popup:target { -webkit-transition:all 1s; -moz-transition:all 1s; transition:all 1s; opacity: 0; visibility: hidden; } @media (min-width: 768px){ .popup-container { width:680px; } } @media (max-width: 767px){ .popup-container { width:80%; margin: 25% auto!important; } } .popup-container { position: relative; margin:7% auto; padding:3px; background: none; color:#333; border-radius: 0px; text-align: center; } button.popup-close { position: absolute; top:3px; right:3px; background-color: #333; padding:7px 10px; font-size: 20px; text-decoration: none; line-height: 1; color:#fff; z-index: 9999999999; } /* end style popup */
JAVASCRIPT
$(document).on("click", function(e) { if ($(e.target).is(".popup-wrapper .popup-container img") === false) { $(".popup-wrapper").hide(); } });
Expand for more options Login