forked from codrops/MorphingSearch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
executable file
·183 lines (177 loc) · 8.57 KB
/
index.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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<!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.0, maximum-scale=1.0, user-scalable=0" />
<title>Morphing Search Input</title>
<meta name="description" content="A search input that morphs into a fullscreen search page." />
<meta name="keywords" content="search, input, effect, morph, transition, inspiration" />
<meta name="author" content="Codrops" />
<link rel="shortcut icon" href="../favicon.ico">
<link href='http://fonts.googleapis.com/css?family=Raleway:100,700,800' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="fonts/font-awesome-4.2.0/css/font-awesome.min.css" />
<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" />
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<aside class="sidebar clearfix">
<nav>
<a href="#"><i class="fa fa-fw fa-comments-o"></i></a>
<a href="#"><i class="fa fa-fw fa-heart-o"></i></a>
<a href="#"><i class="fa fa-fw fa-send-o"></i></a>
<a href="#"><i class="fa fa-fw fa-smile-o"></i></a>
</nav>
</aside>
<div id="morphsearch" class="morphsearch">
<form class="morphsearch-form">
<input class="morphsearch-input" type="search" placeholder="Search..."/>
<button class="morphsearch-submit" type="submit">Search</button>
</form>
<div class="morphsearch-content">
<div class="dummy-column">
<h2>People</h2>
<a class="dummy-media-object" href="http://twitter.com/SaraSoueidan">
<img class="round" src="http://0.gravatar.com/avatar/81b58502541f9445253f30497e53c280?s=50&d=identicon&r=G" alt="Sara Soueidan"/>
<h3>Sara Soueidan</h3>
</a>
<a class="dummy-media-object" href="http://twitter.com/rachsmithtweets">
<img class="round" src="http://0.gravatar.com/avatar/48959f453dffdb6236f4b33eb8e9f4b7?s=50&d=identicon&r=G" alt="Rachel Smith"/>
<h3>Rachel Smith</h3>
</a>
<a class="dummy-media-object" href="http://www.twitter.com/peterfinlan">
<img class="round" src="http://0.gravatar.com/avatar/06458359cb9e370d7c15bf6329e5facb?s=50&d=identicon&r=G" alt="Peter Finlan"/>
<h3>Peter Finlan</h3>
</a>
<a class="dummy-media-object" href="http://www.twitter.com/pcridesagain">
<img class="round" src="http://1.gravatar.com/avatar/db7700c89ae12f7d98827642b30c879f?s=50&d=identicon&r=G" alt="Patrick Cox"/>
<h3>Patrick Cox</h3>
</a>
<a class="dummy-media-object" href="https://twitter.com/twholman">
<img class="round" src="http://0.gravatar.com/avatar/cb947f0ebdde8d0f973741b366a51ed6?s=50&d=identicon&r=G" alt="Tim Holman"/>
<h3>Tim Holman</h3>
</a>
<a class="dummy-media-object" href="https://twitter.com/shaund0na">
<img class="round" src="http://1.gravatar.com/avatar/9bc7250110c667cd35c0826059b81b75?s=50&d=identicon&r=G" alt="Shaun Dona"/>
<h3>Shaun Dona</h3>
</a>
</div>
<div class="dummy-column">
<h2>Popular</h2>
<a class="dummy-media-object" href="http://tympanus.net/codrops/2014/08/05/page-preloading-effect/">
<img src="img/thumbs/PagePreloadingEffect.png" alt="PagePreloadingEffect"/>
<h3>Page Preloading Effect</h3>
</a>
<a class="dummy-media-object" href="http://tympanus.net/codrops/2014/05/28/arrow-navigation-styles/">
<img src="img/thumbs/ArrowNavigationStyles.png" alt="ArrowNavigationStyles"/>
<h3>Arrow Navigation Styles</h3>
</a>
<a class="dummy-media-object" href="http://tympanus.net/codrops/2014/06/19/ideas-for-subtle-hover-effects/">
<img src="img/thumbs/HoverEffectsIdeasNew.png" alt="HoverEffectsIdeasNew"/>
<h3>Ideas for Subtle Hover Effects</h3>
</a>
<a class="dummy-media-object" href="http://tympanus.net/codrops/2014/07/14/freebie-halcyon-days-one-page-website-template/">
<img src="img/thumbs/FreebieHalcyonDays.png" alt="FreebieHalcyonDays"/>
<h3>Halcyon Days Template</h3>
</a>
<a class="dummy-media-object" href="http://tympanus.net/codrops/2014/05/22/inspiration-for-article-intro-effects/">
<img src="img/thumbs/ArticleIntroEffects.png" alt="ArticleIntroEffects"/>
<h3>Inspiration for Article Intro Effects</h3>
</a>
<a class="dummy-media-object" href="http://tympanus.net/codrops/2014/06/26/draggable-dual-view-slideshow/">
<img src="img/thumbs/DraggableDualViewSlideshow.png" alt="DraggableDualViewSlideshow"/>
<h3>Draggable Dual-View Slideshow</h3>
</a>
</div>
<div class="dummy-column">
<h2>Recent</h2>
<a class="dummy-media-object" href="http://tympanus.net/codrops/2014/10/07/tooltip-styles-inspiration/">
<img src="img/thumbs/TooltipStylesInspiration.png" alt="TooltipStylesInspiration"/>
<h3>Tooltip Styles Inspiration</h3>
</a>
<a class="dummy-media-object" href="http://tympanus.net/codrops/2014/09/23/animated-background-headers/">
<img src="img/thumbs/AnimatedHeaderBackgrounds.png" alt="AnimatedHeaderBackgrounds"/>
<h3>Animated Background Headers</h3>
</a>
<a class="dummy-media-object" href="http://tympanus.net/codrops/2014/09/16/off-canvas-menu-effects/">
<img src="img/thumbs/OffCanvas.png" alt="OffCanvas"/>
<h3>Off-Canvas Menu Effects</h3>
</a>
<a class="dummy-media-object" href="http://tympanus.net/codrops/2014/09/02/tab-styles-inspiration/">
<img src="img/thumbs/TabStyles.png" alt="TabStyles"/>
<h3>Tab Styles Inspiration</h3>
</a>
<a class="dummy-media-object" href="http://tympanus.net/codrops/2014/08/19/making-svgs-responsive-with-css/">
<img src="img/thumbs/ResponsiveSVGs.png" alt="ResponsiveSVGs"/>
<h3>Make SVGs Responsive with CSS</h3>
</a>
<a class="dummy-media-object" href="http://tympanus.net/codrops/2014/07/23/notification-styles-inspiration/">
<img src="img/thumbs/NotificationStyles.png" alt="NotificationStyles"/>
<h3>Notification Styles Inspiration</h3>
</a>
</div>
</div><!-- /morphsearch-content -->
<span class="morphsearch-close"></span>
</div><!-- /morphsearch -->
<header class="codrops-header">
<h1>Morphing Search <span>A search input that morphs into a fullscreen search page.</span></h1>
<div class="codrops-links">
<a class="codrops-icon codrops-icon-prev" href="http://tympanus.net/Development/WobblySlideshowEffect/"><span>Previous Demo</span></a>
<a class="codrops-icon codrops-icon-drop" href="http://tympanus.net/codrops/?p=21106"><span>Back to the Codrops Article</span></a>
</div>
</header>
<div class="overlay"></div>
</div><!-- /container -->
<script src="js/classie.js"></script>
<script>
(function() {
var morphSearch = document.getElementById( 'morphsearch' ),
input = morphSearch.querySelector( 'input.morphsearch-input' ),
ctrlClose = morphSearch.querySelector( 'span.morphsearch-close' ),
isOpen = isAnimating = false,
// show/hide search area
toggleSearch = function(evt) {
// return if open and the input gets focused
if( evt.type.toLowerCase() === 'focus' && isOpen ) return false;
if( isOpen ) {
classie.remove( morphSearch, 'open' );
// trick to hide input text once the search overlay closes
// todo: hardcoded times, should be done after transition ends
if( input.value !== '' ) {
setTimeout(function() {
classie.add( morphSearch, 'hideInput' );
setTimeout(function() {
classie.remove( morphSearch, 'hideInput' );
input.value = '';
}, 300 );
}, 500);
}
input.blur();
}
else {
classie.add( morphSearch, 'open' );
}
isOpen = !isOpen;
};
// events
input.addEventListener( 'focus', toggleSearch );
ctrlClose.addEventListener( 'click', toggleSearch );
// esc key closes search overlay
// keyboard navigation events
document.addEventListener( 'keydown', function( ev ) {
var keyCode = ev.keyCode || ev.which;
if( keyCode === 27 && isOpen ) {
toggleSearch(ev);
}
} );
/***** for demo purposes only: don't allow to submit the form *****/
morphSearch.querySelector( 'button[type="submit"]' ).addEventListener( 'click', function(ev) { ev.preventDefault(); } );
})();
</script>
</body>
</html>