Jquery code to simple popup onclick

Simple popup onclick using jquery


See this in video: Simple popup
Html page:
<a class="open" data-open="popup" href="https://www.blogger.com/blogger.g?blogID=1018919755583750916#"> Open</a>


Css:
.popup{ top:0px; left:0px; width:100%; height:100%; position:fixed; display:none; background:rgba(0,0,0,0.75); } .inner{ max-width:650px; width:90%; top:50%; position:absolute; -webkit-transform:translate(50%, -50%); transform:translate(50%, -50%); box-shadow:0px 0px 6px rgba(0,0,0,0.5); background:#FFFFFF; color:#000000; } .closing{ display:inline-block; position:absolute; width:30px; height:30px; padding-top:4px; transition:0.5s all; top:0px; left:0px; -webkit-transform:translate(50%, -50%); transform:translate(50%, -50%); background:#CCCCCC; font-size:25px; text-align:center; font-family: Arial, Helvetica, Sans-serif; text-decoration:none; color:#000000; border-radius:100px; } .closing:hover{ -webkit-transform:translate(50%, -50%) rotate(180deg); transform:translate(50%, -50%) rotate(180deg); background:#FF0000; color:#FFFFFF; text-decoration:none; transition:0.5s all; }

Jquery:
<script src="jquery-2.2.1.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function(){ //open $('[data-open]').click(function(e){ $target = $(this).attr("data-open"); $('[data="'+ $target +'"]').fadeIn(350); e.preventDefault(); }); //close $('[data-close]').click(function(e){ $target = $(this).attr("data-close"); $('[data="'+ $target +'"]').fadeOut(350); e.preventDefault(); }); }); </script>

Friends, If you have any questions please leave your questions in comment box.Thankyou

Comments

Popular posts from this blog

PHP Login and Registration script

Multiple image upload to database and display from it

Java program to display diamond pattern