forked from codrops/ButtonComponentMorph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index2.html
executable file
·136 lines (127 loc) · 5.31 KB
/
index2.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Morphing Buttons Concept | Demo 2</title>
<meta name="description" content="Morphing Buttons Concept: Inspiration for revealing content by morphing the action element" />
<meta name="keywords" content="expanding button, morph, modal, fullscreen, transition, ui" />
<meta name="author" content="Codrops" />
<link rel="shortcut icon" href="../favicon.ico">
<link rel="stylesheet" type="text/css" href="css/normalize.css" />
<link rel="stylesheet" type="text/css" href="css/demo.css" />
<link rel="stylesheet" type="text/css" href="css/component.css" />
<link rel="stylesheet" type="text/css" href="css/content.css" />
<script src="js/modernizr.custom.js"></script>
</head>
<body>
<div class="container">
<!-- Top Navigation -->
<div class="codrops-top clearfix">
<a class="codrops-icon codrops-icon-prev" href="http://tympanus.net/Development/PageLoadingEffects/"><span>Previous Demo</span></a>
<span class="right"><a class="codrops-icon codrops-icon-drop" href="http://tympanus.net/codrops/?p=19004"><span>Back to the Codrops Article</span></a></span>
</div>
<header class="codrops-header">
<h1>Morphing Buttons Concept</h1>
<p>Inspiration for revealing content by morphing the action element. Examples:</p>
<nav class="codrops-demos">
<a href="index.html">Login/Signup</a>
<a class="current-demo" href="index2.html">Terms</a>
<a href="index3.html">Info Overlay</a>
<a href="index4.html">Subscribe</a>
<a href="index5.html">Share</a>
<a href="index6.html">Video Player</a>
<a href="index7.html">Sidebar Settings</a>
</nav>
</header>
<section>
<p>Click the button below to see it expanding into a <strong>modal dialog</strong>:</p>
<div class="mockup-content">
<span></span><span></span><span></span><span></span>
<div class="morph-button morph-button-modal morph-button-modal-1 morph-button-fixed">
<button type="button">Terms & Conditions</button>
<div class="morph-content">
<div>
<div class="content-style-text">
<span class="icon icon-close">Close the dialog</span>
<h2>Terms & Conditions</h2>
<p>Pea horseradish azuki bean lettuce avocado asparagus okra. Kohlrabi radish okra azuki bean corn fava bean mustard tigernut juccama green bean celtuce collard greens avocado quandong <strong>fennel gumbo</strong> black-eyed pea. Grape silver beet watercress potato tigernut corn groundnut. Chickweed okra pea winter purslane coriander yarrow sweet pepper radish garlic brussels sprout groundnut summer purslane earthnut pea <strong>tomato spring onion</strong> azuki bean gourd.</p>
<p><input id="terms" type="checkbox" /><label for="terms">I accept the terms & conditions.</label></p>
</div>
</div>
</div>
</div><!-- morph-button -->
<span></span>
<span></span>
</div><!-- /form-mockup -->
</section>
<section class="related">
<p>If you enjoyed this demo you might also like:</p>
<a href="http://tympanus.net/Development/ProgressButtonStyles/">
<img src="http://tympanus.net/codrops/wp-content/uploads/2013/12/ProgressButtonStyles-300x162.png" />
<h3>Progress Button Styles</h3>
</a>
<a href="http://tympanus.net/Development/SidebarTransitions/">
<img src="http://tympanus.net/codrops/wp-content/uploads/2013/08/sidebartransitions-300x162.png" />
<h3>Sidebar Transitions</h3>
</a>
</section>
</div><!-- /container -->
<script src="js/classie.js"></script>
<script src="js/uiMorphingButton_fixed.js"></script>
<script>
(function() {
var docElem = window.document.documentElement, didScroll, scrollPosition;
// trick to prevent scrolling when opening/closing button
function noScrollFn() {
window.scrollTo( scrollPosition ? scrollPosition.x : 0, scrollPosition ? scrollPosition.y : 0 );
}
function noScroll() {
window.removeEventListener( 'scroll', scrollHandler );
window.addEventListener( 'scroll', noScrollFn );
}
function scrollFn() {
window.addEventListener( 'scroll', scrollHandler );
}
function canScroll() {
window.removeEventListener( 'scroll', noScrollFn );
scrollFn();
}
function scrollHandler() {
if( !didScroll ) {
didScroll = true;
setTimeout( function() { scrollPage(); }, 60 );
}
};
function scrollPage() {
scrollPosition = { x : window.pageXOffset || docElem.scrollLeft, y : window.pageYOffset || docElem.scrollTop };
didScroll = false;
};
scrollFn();
var UIBtnn = new UIMorphingButton( document.querySelector( '.morph-button' ), {
closeEl : '.icon-close',
onBeforeOpen : function() {
// don't allow to scroll
noScroll();
},
onAfterOpen : function() {
// can scroll again
canScroll();
},
onBeforeClose : function() {
// don't allow to scroll
noScroll();
},
onAfterClose : function() {
// can scroll again
canScroll();
}
} );
document.getElementById( 'terms' ).addEventListener( 'change', function() {
UIBtnn.toggle();
} );
})();
</script>
</body>
</html>