How we can create a full page intro navigation using HTML CSS JavaScript? Solution: See this CSS Full Page Navigation With JavaScript, HTML Full Page Intro.
Previously I have shared many types of navigations, but this is different because of it is cover’s full page. Basically, these types of full page menu use in modern websites, it looks pretty good. This menu contains a hamburger menu icon when you will click on that it then a full height and width menu will appear on the screen.
Today you will learn to create HTML Full Page Intro with CSS and JavaScript. This design has, a background image, a heading line middle of the page, and a hamburger menu icon on the bottom bar in right side. After clicking the icon there will appear menu items list-wise with covering the whole height and width of the webpage.
So, Today I am sharing CSS Full Page Navigation With JavaScript. This program mostly created is with CSS, but HTML and JS have own important parts. That full page intro program is a responsive design, that means it will fit on every screen size like desktop or mobile. I think this program will very useful for you, and also can use it to creating your website.
If you are thinking now how this full page intro actually is, then see the preview given below.
Preview Of HTML Responsive Full-Page Intro
See this video preview to getting an idea of how this intro page looks like.
Now you can see this visually, you also can see it live by pressing the button given above. If you like this, then get the source code of its.
You May Also Like:
- Horizontal Tab Menu With jQuery
- HTML Login and Signup Form
- CSS Border Transition Effects
- JavaScript Portfolio Filter Gallery
CSS Full Page Navigation With JavaScript Source Code
Before sharing source code, let’s talk about it. First I have created elements using HTML main tag (info) and placed a section and a header inside it. Now I created a nav and placed menu items inside that using HTML list <ul> & <li> tags. Also created a hyperlink for the close button. And linked jQuery and other files inside the HTML.
Now using CSS, I have placed all the elements on the right places like placed menu in button side and placed the hamburger icon in bottom right side. In the HTML file, I gave an ID for the nav and linked hamburger icon using the target method ( <a href="ID"> ). With CSS I gave style all the elements, like gave full width and height to the nav section, and put a background image, etc.
There I have used jQuery which is a JavaScript library. Using JS I have done the work of toggle feature, when you will click on the menu icons then the nav will appear and click on the close icon it will close. There is also a function for cover full width and height of the screen, that’s also powered by JS.
Left all other things you will understand after getting the codes, I can’t explain all in writing. For creating this program you have to create 3 files for that. First for HTML, second for CSS, and the third for JavaScript. Follow the steps to creating this without any error.
index.html
Create an HTML file named ‘index.html‘ and put these codes given below.
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 |
<!DOCTYPE html> <!--Code By Webdevtrick ( https://webdevtrick.com )--> <html lang="en"> <head> <meta charset="UTF-8"> <title>Full Page Intro Navigation | Webdevtrick.com</title> <script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.min.js" type="text/javascript"></script> <link href="https://fonts.googleapis.com/css?family=Questrial&display=swap" rel="stylesheet"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <link rel="stylesheet" href="style.css"> </head> <body> <main id="wrapper"> <section id="intro"> <h1>Welcome !! <br>Full Page Intro Navigation</h1> <header class="nav"> <a class="menu" href="#main-nav">Menu<span></span></a> </header> <div class="bg"></div> </section> </main> <div class="transparent-shadow"></div> <nav id="main-nav"> <ul> <li><a href="#"><span>About</span></a></li> <li><a href="#"><span>Pricing</span></a></li> <li><a href="#"><span>Services</span></a></li> <li><a href="#"><span>Portfolio</span></a></li> <li><a href="#"><span>Contact us</span></a></li> </ul> <a href="#0" class="close-nav">Close<span></span></a> </nav> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="function.js"></script> </body> </html> |
style.css
Now create a CSS file ‘style.css‘ and put these codes given below.
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 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 |
/* Code By Webdevtrick ( https://webdevtrick.com ) */ html * { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } *, *:after, *:before { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } html, body { height: 100%; } body { font-size: 100%; font-family: 'Questrial', sans-serif; background-color: #2e2d32; } a { color: #ffffff; text-decoration: none; } .cd-container { width: 90%; max-width: 768px; margin: 0 auto; } .cd-container::after { content: ''; display: table; clear: both; } #wrapper { position: relative; height: 100%; overflow: hidden; background-color: #3a393f; box-shadow: 0 0 40px rgba(0, 0, 0, 0.8); z-index: 1; -webkit-transform: translateZ(0); -webkit-backface-visibility: hidden; transition-property: transform; -webkit-transition-duration: 0.5s; -moz-transition-duration: 0.5s; transition-duration: 0.5s; } #wrapper.move-out { transform: scale(0.6); } .no-js #wrapper { height: auto; overflow-x: auto; overflow-y: auto; } #intro { position: relative; height: 100%; background: url("https://images.pexels.com/photos/831243/pexels-photo-831243.jpeg") no-repeat center center; background-size: cover; } #intro h1 { position: absolute; width: 90%; left: 50%; top: 50%; bottom: auto; right: auto; transform: translateX(-50%) translateY(-50%); text-align: center; font-size: 18px; font-size: 1.125rem; font-weight: bold; color: #ffffff; } @media only screen and (min-width: 768px) { #intro h1 { font-size: 26px; font-size: 1.625rem; } } .no-js #intro { height: 640px; } .nav { position: absolute; bottom: 0; left: 0; width: 100%; height: 50px; z-index: 2; background: rgba(58, 57, 63, 0.6); -webkit-transition: background 0.2s; -moz-transition: background 0.2s; transition: background 0.2s; } @media only screen and (min-width: 768px) { .nav { height: 80px; } } .bg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: #212121; background-size: cover; -webkit-filter: blur(4px); filter: blur(4px); } .no-js .bg { display: none; } .menu { display: inline-block; position: absolute; right: 0; top: 0; height: 50px; line-height: 50px; padding: 0 .8em; text-transform: uppercase; font-weight: bold; font-size: 14px; font-size: 0.875rem; } .menu span { position: relative; display: inline-block; width: 18px; height: 2px; background-color: #ffffff; vertical-align: middle; margin-left: 10px; transform: translateY(-2px); } .menu span::before, .menu span::after { content: ''; display: inline-block; position: absolute; left: 0; width: 100%; height: 100%; background-color: inherit; -webkit-transition: all 0.2s; -moz-transition: all 0.2s; transition: all 0.2s; } .menu span::before { top: -6px; } .menu span::after { bottom: -6px; } .no-touch .menu:hover span::before { top: -8px; } .no-touch .menu:hover span::after { bottom: -8px; } @media only screen and (min-width: 768px) { .menu { top: 16px; right: 10px; font-size: 16px; font-size: 1rem; } } @media only screen and (min-width: 1170px) { .menu { right: 60px; } } #main-nav { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #dfdfdf; -webkit-transform: translateZ(0); -webkit-backface-visibility: hidden; transform: translateY(-100%); transition-property: transform; transition-duration: 0.5s; z-index: 3; } #main-nav ul { height: 100%; } #main-nav li { height: 20%; } #main-nav li a { position: relative; display: block; padding: 0 10%; height: 100%; border-bottom: 1px solid #212121; color: #212121; font-size: 20px; font-size: 1.25rem; font-weight: bold; } #main-nav li a span { position: absolute; left: 50%; top: 50%; bottom: auto; right: auto; transform: translateX(-50%) translateY(-50%); } .no-touch #main-nav li a:hover { background-color: #FFF; } #main-nav li:last-child a { border-bottom: none; } #main-nav .close-nav { position: absolute; top: 0; right: 0; display: inline-block; width: 40px; height: 40px; background-color: #ff4444; overflow: hidden; text-indent: 100%; white-space: nowrap; } #main-nav .close-nav::before, #main-nav .close-nav::after { content: ''; display: inline-block; position: absolute; top: 18px; left: 10px; width: 20px; height: 3px; background-color: #FFF; transition-property: transform; transition-duration: 0.3s; } #main-nav .close-nav::before { transform: rotate(45deg); } #main-nav .close-nav::after { transform: rotate(135deg); } .no-touch #main-nav .close-nav:hover::before { transform: rotate(225deg); } .no-touch #main-nav .close-nav:hover::after { transform: rotate(315deg); } #main-nav.is-visible { box-shadow: 0 0 20px rgba(0, 0, 0, 0.4); transform: translateY(0); } .no-js #main-nav { position: static; transform: translateY(0); } .no-js #main-nav .close-nav { display: none; } .transparent-shadow { position: fixed; top: 0; left: 0; height: 100%; width: 100%; background: rgba(0, 0, 0, 0.4); z-index: 2; opacity: 0; visibility: hidden; transition: visibility 0s 0.5s, opacity 0.5s 0s; } .transparent-shadow.is-visible { opacity: 1; visibility: visible; transition-delay: 0s; } |
function.js
The final step, create a JavaScript file named ‘function.js‘ and put the codes.
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 |
// Code By Webdevtrick ( https://webdevtrick.com ) jQuery(document).ready(function($){ //open menu $('.menu').on('click', function(event){ event.preventDefault(); $('#wrapper').addClass('move-out'); $('#main-nav').addClass('is-visible'); $('.transparent-shadow').addClass('is-visible'); }); //close menu $('.close-nav').on('click', function(event){ event.preventDefault(); $('#wrapper').removeClass('move-out'); $('#main-nav').removeClass('is-visible'); $('.transparent-shadow').removeClass('is-visible'); }); //blur effect set_clip_property(); $(window).on('resize', function(){ set_clip_property(); }); function set_clip_property() { var $header_height = $('.nav').height(), $window_height = $(window).height(), $header_top = $window_height - $header_height, $window_width = $(window).width(); $('.bg').css('clip', 'rect('+$header_top+'px, '+$window_width+'px, '+$window_height+'px, 0px)'); } }); |
That’s It. Now you have successfully created CSS Full Page Navigation With JavaScript, HTML Full Page Intro with responsive design. If you have any doubt or question comment down below.
Thanks For Visiting, Keep Visiting.
how to convert html(css) to pdf using javascript