A Pen by Jasmin Skopljak on CodePen.
Created
February 13, 2014 14:34
-
-
Save pavsmk/8976069 to your computer and use it in GitHub Desktop.
A Pen by Jasmin Skopljak.
This file contains hidden or 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="container"> | |
<section> | |
<p class="naslov">Fullscreen Overlay Form Style</p> | |
<p> | |
Click on the button to see the magic | |
</p> | |
</section> | |
<button type="button" id="trigger-overlay">Log In</button> | |
</div> | |
<div class="overlay overlay-content"> | |
<button type="button" class="overlay-close">Close</button> | |
<section class="login-part"> | |
<p class="login-overlay"> | |
Log In | |
</p> | |
<form method="post"> | |
<input type="text" name="u" placeholder="Username" required="required" /> | |
<input type="password" name="p" placeholder="Password" required="required" /> | |
<button type="submit" class="btn btn-primary btn-block btn-large">Let me in.</button> | |
</form> | |
</section> | |
</div> | |
<section> | |
<p> | |
This work is inspired by <a href="http://tympanus.net/codrops/2014/02/06/fullscreen-overlay-effects/">this</a> article | |
</p> | |
</section> |
This file contains hidden or 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() { | |
var triggerBttn = document.getElementById( 'trigger-overlay' ), | |
overlay = document.querySelector( 'div.overlay' ), | |
closeBttn = overlay.querySelector( 'button.overlay-close' ); | |
transEndEventNames = { | |
'WebkitTransition': 'webkitTransitionEnd', | |
'MozTransition': 'transitionend', | |
'OTransition': 'oTransitionEnd', | |
'msTransition': 'MSTransitionEnd', | |
'transition': 'transitionend' | |
}, | |
transEndEventName = transEndEventNames[ Modernizr.prefixed( 'transition' ) ], | |
support = { transitions : Modernizr.csstransitions }; | |
function toggleOverlay() { | |
if( classie.has( overlay, 'open' ) ) { | |
classie.remove( overlay, 'open' ); | |
classie.add( overlay, 'close' ); | |
var onEndTransitionFn = function( ev ) { | |
if( support.transitions ) { | |
if( ev.propertyName !== 'visibility' ) return; | |
this.removeEventListener( transEndEventName, onEndTransitionFn ); | |
} | |
classie.remove( overlay, 'close' ); | |
}; | |
if( support.transitions ) { | |
overlay.addEventListener( transEndEventName, onEndTransitionFn ); | |
} | |
else { | |
onEndTransitionFn(); | |
} | |
} | |
else if( !classie.has( overlay, 'close' ) ) { | |
classie.add( overlay, 'open' ); | |
} | |
} | |
triggerBttn.addEventListener( 'click', toggleOverlay ); | |
closeBttn.addEventListener( 'click', toggleOverlay ); | |
})(); | |
/*! | |
* classie - class helper functions | |
* from bonzo https://github.com/ded/bonzo | |
* | |
* classie.has( elem, 'my-class' ) -> true/false | |
* classie.add( elem, 'my-new-class' ) | |
* classie.remove( elem, 'my-unwanted-class' ) | |
* classie.toggle( elem, 'my-class' ) | |
*/ | |
/*jshint browser: true, strict: true, undef: true */ | |
/*global define: false */ | |
( function( window ) { | |
'use strict'; | |
// class helper functions from bonzo https://github.com/ded/bonzo | |
function classReg( className ) { | |
return new RegExp("(^|\\s+)" + className + "(\\s+|$)"); | |
} | |
// classList support for class management | |
// altho to be fair, the api sucks because it won't accept multiple classes at once | |
var hasClass, addClass, removeClass; | |
if ( 'classList' in document.documentElement ) { | |
hasClass = function( elem, c ) { | |
return elem.classList.contains( c ); | |
}; | |
addClass = function( elem, c ) { | |
elem.classList.add( c ); | |
}; | |
removeClass = function( elem, c ) { | |
elem.classList.remove( c ); | |
}; | |
} | |
else { | |
hasClass = function( elem, c ) { | |
return classReg( c ).test( elem.className ); | |
}; | |
addClass = function( elem, c ) { | |
if ( !hasClass( elem, c ) ) { | |
elem.className = elem.className + ' ' + c; | |
} | |
}; | |
removeClass = function( elem, c ) { | |
elem.className = elem.className.replace( classReg( c ), ' ' ); | |
}; | |
} | |
function toggleClass( elem, c ) { | |
var fn = hasClass( elem, c ) ? removeClass : addClass; | |
fn( elem, c ); | |
} | |
var classie = { | |
// full names | |
hasClass: hasClass, | |
addClass: addClass, | |
removeClass: removeClass, | |
toggleClass: toggleClass, | |
// short names | |
has: hasClass, | |
add: addClass, | |
remove: removeClass, | |
toggle: toggleClass | |
}; | |
// transport | |
if ( typeof define === 'function' && define.amd ) { | |
// AMD | |
define( classie ); | |
} else { | |
// browser global | |
window.classie = classie; | |
} | |
})( window ); |
This file contains hidden or 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
@import url(http://fonts.googleapis.com/css?family=Lato:300,400); | |
body { | |
background: #fff; | |
color: #8a8c7e; | |
font-size: 100%; | |
line-height: 1.25; | |
font-family: 'Lato', 'Avenir Next', Arial, sans-serif; | |
} | |
a { | |
color: #99cc33; | |
text-decoration: none; | |
outline: none; | |
} | |
a:hover, a:focus { | |
color: #373e18; | |
} | |
.container { | |
background: #fff; | |
margin: 0 auto; | |
padding: 2em 0 0; | |
text-align: center; | |
} | |
.container h1 { | |
margin: 0; | |
font-weight: 300; | |
font-size: 2.5em; | |
} | |
.container h1 span { | |
display: block; | |
padding: 0 0 0.6em 0.1em; | |
font-size: 0.6em; | |
opacity: 0.7; | |
} | |
.overlay { | |
position: fixed; | |
width: 100%; | |
height: 100%; | |
top: 0; | |
left: 0; | |
background-color: #4a77d4; | |
background-image: -moz-linear-gradient(top, #6eb6de, #4a77d4); | |
background-image: -ms-linear-gradient(top, #6eb6de, #4a77d4); | |
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#6eb6de), to(#4a77d4)); | |
background-image: -webkit-linear-gradient(top, #6eb6de, #4a77d4); | |
background-image: -o-linear-gradient(top, #6eb6de, #4a77d4); | |
background-image: linear-gradient(top, #6eb6de, #4a77d4); | |
background-repeat: repeat-x; | |
filter: progid:dximagetransform.microsoft.gradient(startColorstr=#6eb6de, endColorstr=#4a77d4, GradientType=0); | |
border: 1px solid #3762bc; | |
text-shadow: 1px 1px 1px rgba(0,0,0,0.4); | |
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.5); | |
} | |
/* Overlay closing cross */ | |
.overlay .overlay-close { | |
width: 80px; | |
height: 80px; | |
position: absolute; | |
right: 20px; | |
top: 20px; | |
overflow: hidden; | |
border: none; | |
background: url(http://imageshack.com/a/img716/9558/0r28.png) no-repeat center center; | |
text-indent: 200%; | |
color: transparent; | |
outline: none; | |
z-index: 100; | |
} | |
.login-part{ | |
position: absolute; | |
top: 50%; | |
left: 50%; | |
margin: -150px 0 0 -150px; | |
width:300px; | |
height:300px; | |
} | |
input { | |
width: 100%; | |
margin-bottom: 10px; | |
background: rgba(0,0,0,0.3); | |
border: none; | |
outline: none; | |
padding: 10px; | |
font-size: 13px; | |
color: #fff; | |
text-shadow: 1px 1px 1px rgba(0,0,0,0.3); | |
border: 1px solid rgba(0,0,0,0.3); | |
border-radius: 4px; | |
box-shadow: inset 0 -5px 45px rgba(100,100,100,0.2), 0 1px 1px rgba(255,255,255,0.2); | |
-webkit-transition: box-shadow .5s ease; | |
-moz-transition: box-shadow .5s ease; | |
-o-transition: box-shadow .5s ease; | |
-ms-transition: box-shadow .5s ease; | |
transition: box-shadow .5s ease; | |
} | |
input:focus { box-shadow: inset 0 -5px 45px rgba(100,100,100,0.4), 0 1px 1px rgba(255,255,255,0.2); } | |
.btn { | |
display: inline-block; | |
*display: inline; | |
*zoom: 1; | |
padding: 4px 10px 4px; | |
margin-bottom: 0; | |
font-size: 13px; | |
line-height: 18px; | |
color: #333333; | |
text-align: center; | |
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75); | |
vertical-align: middle; | |
background-color: #f5f5f5; | |
background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6); | |
background-image: -ms-linear-gradient(top, #ffffff, #e6e6e6); | |
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6)); | |
background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6); | |
background-image: -o-linear-gradient(top, #ffffff, #e6e6e6); | |
background-image: linear-gradient(top, #ffffff, #e6e6e6); | |
background-repeat: repeat-x; | |
filter: progid:dximagetransform.microsoft.gradient(startColorstr=#ffffff, endColorstr=#e6e6e6, GradientType=0); | |
border-color: #e6e6e6 #e6e6e6 #e6e6e6; | |
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); | |
border: 1px solid #e6e6e6; | |
-webkit-border-radius: 4px; | |
-moz-border-radius: 4px; | |
border-radius: 4px; | |
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); | |
-moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); | |
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); | |
cursor: pointer; | |
*margin-left: .3em; | |
} | |
.btn:hover, | |
.btn:active, | |
.btn.active, | |
.btn.disabled, | |
.btn[disabled] { | |
background-color: #e6e6e6; | |
} | |
.btn-large { | |
padding: 9px 14px; | |
font-size: 15px; | |
line-height: normal; | |
-webkit-border-radius: 5px; | |
-moz-border-radius: 5px; | |
border-radius: 5px; | |
} | |
.btn:hover { | |
color: #333333; | |
text-decoration: none; | |
background-color: #e6e6e6; | |
background-position: 0 -15px; | |
-webkit-transition: background-position 0.1s linear; | |
-moz-transition: background-position 0.1s linear; | |
-ms-transition: background-position 0.1s linear; | |
-o-transition: background-position 0.1s linear; | |
transition: background-position 0.1s linear; | |
} | |
.btn-primary, | |
.btn-primary:hover { | |
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); | |
color: #ffffff; | |
} | |
.btn-primary.active { | |
color: rgba(255, 255, 255, 0.75); | |
} | |
.btn-primary { | |
background-color: #4a77d4; | |
background-image: -moz-linear-gradient(top, #6eb6de, #4a77d4); | |
background-image: -ms-linear-gradient(top, #6eb6de, #4a77d4); | |
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#6eb6de), to(#4a77d4)); | |
background-image: -webkit-linear-gradient(top, #6eb6de, #4a77d4); | |
background-image: -o-linear-gradient(top, #6eb6de, #4a77d4); | |
background-image: linear-gradient(top, #6eb6de, #4a77d4); | |
background-repeat: repeat-x; | |
filter: progid:dximagetransform.microsoft.gradient(startColorstr=#6eb6de, endColorstr=#4a77d4, GradientType=0); | |
border: 1px solid #3762bc; | |
text-shadow: 1px 1px 1px rgba(0,0,0,0.4); | |
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.5); | |
} | |
.btn-primary:hover, | |
.btn-primary:active, | |
.btn-primary.active, | |
.btn-primary.disabled, | |
.btn-primary[disabled] { | |
filter: none; | |
background-color: #4a77d4; | |
} | |
.btn-block { | |
width: 100%; | |
display:block; | |
} | |
#trigger-overlay{ | |
display: inline-block; | |
background-color: #4a77d4; | |
background-image: -moz-linear-gradient(top, #6eb6de, #4a77d4); | |
background-image: -ms-linear-gradient(top, #6eb6de, #4a77d4); | |
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#6eb6de), to(#4a77d4)); | |
background-image: -webkit-linear-gradient(top, #6eb6de, #4a77d4); | |
background-image: -o-linear-gradient(top, #6eb6de, #4a77d4); | |
background-image: linear-gradient(top, #6eb6de, #4a77d4); | |
background-repeat: repeat-x; | |
filter: progid:dximagetransform.microsoft.gradient(startColorstr=#6eb6de, endColorstr=#4a77d4, GradientType=0); | |
border: 1px solid #3762bc; | |
text-shadow: 1px 1px 1px rgba(0,0,0,0.4); | |
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.5); | |
color: #fff; | |
font-weight: 400; | |
padding: 15px 40px; | |
margin: 5px; | |
text-transform: uppercase; | |
border: none; | |
border-radius: 2px; | |
letter-spacing: 1px; | |
outline: none; | |
} | |
.overlay-content{ | |
opacity: 0; | |
visibility: hidden; | |
-webkit-transition: opacity 0.5s, visibility 0s 0.5s; | |
transition: opacity 0.5s, visibility 0s 0.5s; | |
} | |
.overlay-content.open { | |
opacity: 1; | |
visibility: visible; | |
-webkit-transition: opacity 0.5s; | |
transition: opacity 0.5s; | |
} | |
section p { | |
max-width: 600px; | |
margin: 0 auto; | |
padding: 20px 0; | |
font-size: 1.2em; | |
text-align: center; | |
} | |
section p a { | |
color: blue; | |
} | |
section .naslov{ | |
margin: 0 auto; | |
font-weight: 300; | |
font-size: 2.5em; | |
} | |
section .login-overlay{ | |
color: #fff; | |
font-size: 2.5em; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment