A Pen by Jahid Hasan on CodePen.
Created
September 20, 2015 11:09
-
-
Save jahidHn/1eac399c58921397d383 to your computer and use it in GitHub Desktop.
jquery.s
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="messagepop pop"> | |
<form method="post" id="new_message" action="/messages"> | |
<p><label for="email">Your email or name</label><input type="text" size="30" name="email" id="email" /></p> | |
<p><label for="body">Message</label><textarea rows="6" name="body" id="body" cols="35"></textarea></p> | |
<p><input type="submit" value="Send Message" name="commit" id="message_submit"/> or <a class="close" href="/">Cancel</a></p> | |
</form> | |
</div> | |
<a href="/contact" id="contact">Contact Us</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function deselect(e) { | |
$('.pop').slideFadeToggle(function() { | |
e.removeClass('selected'); | |
}); | |
} | |
$(function() { | |
$('#contact').on('click', function() { | |
if($(this).hasClass('selected')) { | |
deselect($(this)); | |
} else { | |
$(this).addClass('selected'); | |
$('.pop').slideFadeToggle(); | |
} | |
return false; | |
}); | |
$('.close').on('click', function() { | |
deselect($('#contact')); | |
return false; | |
}); | |
}); | |
$.fn.slideFadeToggle = function(easing, callback) { | |
return this.animate({ opacity: 'toggle', height: 'toggle' }, 'fast', easing, callback); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a.selected { | |
background-color:#1F75CC; | |
color:white; | |
z-index:100; | |
} | |
.messagepop { | |
background-color:#FFFFFF; | |
border:1px solid #999999; | |
cursor:default; | |
display:none; | |
margin-top: 15px; | |
position:absolute; | |
text-align:left; | |
width:394px; | |
z-index:50; | |
padding: 25px 25px 20px; | |
} | |
label { | |
display: block; | |
margin-bottom: 3px; | |
padding-left: 15px; | |
text-indent: -15px; | |
} | |
.messagepop p, .messagepop.div { | |
border-bottom: 1px solid #EFEFEF; | |
margin: 8px 0; | |
padding-bottom: 8px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment