Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
Google Bottom Bar Navigation Pattern
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Markshall" data-source="post: 444607" data-attributes="member: 1872"><p>It's been a while as I've been mad busy at work, but I saw a Dribbble design I liked and wanted to replicate it.</p><p></p><p>Tried doing it without JavaScript as well.</p><p></p><p>The design was this:</p><p><img src="https://cdn.dribbble.com/users/30252/screenshots/5925052/tab-ui-final.gif" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><p>My result was this: (less smooth but it works)</p><p><a href="https://codepen.io/Markshall/pen/rPzELR" target="_blank">https://codepen.io/Markshall/pen/rPzELR</a></p><p></p><p>HTML:</p><p>[CODE=html]<!DOCTYPE html></p><p><html lang="en"></p><p> <head></p><p> <meta charset="UTF-8" /></p><p> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" /></p><p> <title>Document</title></p><p> </p><p> <link rel="stylesheet" href="//use.fontawesome.com/releases/v5.7.1/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous" /></p><p> <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Source+Sans+Pro" /></p><p> <link rel="stylesheet" href="style.css" /></p><p> </head></p><p></p><p> <body></p><p> <div class="bottom-bar"></p><p> <div class="bottom-bar--items"></p><p> <div class="bottom-bar--item"></p><p> <input type="radio" name="bottom-bar--selected" id="bottom-bar--alpha" checked /></p><p> <label for="bottom-bar--alpha"></label></p><p> <div class="icon"><i class="fa fa-home"></i></div></p><p> <div class="name">Home</div></p><p> </div></p><p> </p><p> <div class="bottom-bar--item"></p><p> <input type="radio" name="bottom-bar--selected" id="bottom-bar--bravo" /></p><p> <label for="bottom-bar--bravo"></label></p><p> <div class="icon"><i class="fa fa-heart"></i></div></p><p> <div class="name">Likes</div></p><p> </div></p><p> </p><p> <div class="bottom-bar--item"></p><p> <input type="radio" name="bottom-bar--selected" id="bottom-bar--charlie" /></p><p> <label for="bottom-bar--charlie"></label></p><p> <div class="icon"><i class="fa fa-search"></i></div></p><p> <div class="name">Search</div></p><p> </div></p><p> </p><p> <div class="bottom-bar--item"></p><p> <input type="radio" name="bottom-bar--selected" id="bottom-bar--delta" /></p><p> <label for="bottom-bar--delta"></label></p><p> <div class="icon"><i class="fa fa-user"></i></div></p><p> <div class="name">Profile</div></p><p> </div></p><p> </div></p><p> </div></p><p> </body></p><p></html>[/CODE]</p><p></p><p>SCSS:</p><p>[CODE=scss]$purple: #5b37b7;</p><p>$pink: #c33c96;</p><p>$yellow: #e6a919;</p><p>$blue: #1194aa;</p><p></p><p>* {</p><p> box-sizing: border-box;</p><p> margin: 0;</p><p> border: 0;</p><p> padding: 0;</p><p>}</p><p></p><p>body {</p><p> background-color: #f7f7f7;</p><p> display: flex;</p><p> justify-content: center;</p><p> align-items: center;</p><p> min-height: 100vh;</p><p> font-family: 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif;</p><p>}</p><p></p><p>.bottom-bar {</p><p> background-color: #fff;</p><p> border-bottom-left-radius: 30px;</p><p> border-bottom-right-radius: 30px;</p><p> padding: 30px 50px;</p><p> box-shadow: 0px 20px 90px rgba(50, 50, 50, .3);</p><p></p><p> &--items {</p><p> display: flex;</p><p> align-items: center;</p><p> justify-content: space-between;</p><p> }</p><p></p><p> &--item {</p><p> display: flex;</p><p> align-items: center;</p><p> justify-content: center;</p><p> position: relative;</p><p> padding: 15px 25px;</p><p> </p><p> &:not(:last-child) {</p><p> margin-right: 15px;</p><p> }</p><p> </p><p> &:nth-child(1) {</p><p> .name {color: $purple;}</p><p> </p><p> [type="radio"]:checked {</p><p> & ~ .icon i {color: $purple;}</p><p> & ~ label { background-color: rgba($purple, .25);}</p><p> }</p><p> }</p><p> </p><p> &:nth-child(2) {</p><p> .name {color: $pink;}</p><p> </p><p> [type="radio"]:checked {</p><p> & ~ .icon i {color: $pink;}</p><p> & ~ label { background-color: rgba($pink, .25);}</p><p> }</p><p> }</p><p> </p><p> &:nth-child(3) {</p><p> .name {color: $yellow;}</p><p> </p><p> [type="radio"]:checked {</p><p> & ~ .icon i {color: $yellow;}</p><p> & ~ label { background-color: rgba($yellow, .25);}</p><p> }</p><p> }</p><p> </p><p> &:nth-child(4) {</p><p> .name {color: $blue;}</p><p> </p><p> [type="radio"]:checked {</p><p> & ~ .icon i {color: $blue;}</p><p> & ~ label { background-color: rgba($blue, .25);}</p><p> }</p><p> }</p><p> </p><p> label {</p><p> position: absolute;</p><p> top: 0; left: 0;</p><p> height: 100%;</p><p> width: 100%;</p><p> cursor: pointer;</p><p> border-radius: 30px;</p><p> flex: none;</p><p> background-color: rgba(255, 255, 255, 0);</p><p> transition: background-color .15s ease-in-out;</p><p> }</p><p> </p><p> [type="radio"] {</p><p> display: none;</p><p> position: absolute;</p><p> top: 0; left: 0;</p><p> height: 0;</p><p> width: 0;</p><p> -webkit-appearance: none;</p><p> flex: none;</p><p> </p><p> &:checked {</p><p> & ~ .name {</p><p> margin-left: 15px;</p><p> display: block;</p><p> width: 100%;</p><p> }</p><p> }</p><p> }</p><p> </p><p> .icon {</p><p> </p><p> i {</p><p> color: #000;</p><p> font-size: 24px;</p><p> }</p><p> }</p><p> </p><p> .name {</p><p> font: {</p><p> weight: 600;</p><p> size: 16px;</p><p> }</p><p> width: 0%;</p><p> margin-left: -15px;</p><p> overflow: hidden;</p><p> transition: all .5s ease-in-out;</p><p> }</p><p> }</p><p>}[/CODE]</p><p></p><p>Hope you like</p></blockquote><p></p>
[QUOTE="Markshall, post: 444607, member: 1872"] It's been a while as I've been mad busy at work, but I saw a Dribbble design I liked and wanted to replicate it. Tried doing it without JavaScript as well. The design was this: [IMG]https://cdn.dribbble.com/users/30252/screenshots/5925052/tab-ui-final.gif[/IMG] My result was this: (less smooth but it works) [URL]https://codepen.io/Markshall/pen/rPzELR[/URL] HTML: [CODE=html]<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" /> <title>Document</title> <link rel="stylesheet" href="//use.fontawesome.com/releases/v5.7.1/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous" /> <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Source+Sans+Pro" /> <link rel="stylesheet" href="style.css" /> </head> <body> <div class="bottom-bar"> <div class="bottom-bar--items"> <div class="bottom-bar--item"> <input type="radio" name="bottom-bar--selected" id="bottom-bar--alpha" checked /> <label for="bottom-bar--alpha"></label> <div class="icon"><i class="fa fa-home"></i></div> <div class="name">Home</div> </div> <div class="bottom-bar--item"> <input type="radio" name="bottom-bar--selected" id="bottom-bar--bravo" /> <label for="bottom-bar--bravo"></label> <div class="icon"><i class="fa fa-heart"></i></div> <div class="name">Likes</div> </div> <div class="bottom-bar--item"> <input type="radio" name="bottom-bar--selected" id="bottom-bar--charlie" /> <label for="bottom-bar--charlie"></label> <div class="icon"><i class="fa fa-search"></i></div> <div class="name">Search</div> </div> <div class="bottom-bar--item"> <input type="radio" name="bottom-bar--selected" id="bottom-bar--delta" /> <label for="bottom-bar--delta"></label> <div class="icon"><i class="fa fa-user"></i></div> <div class="name">Profile</div> </div> </div> </div> </body> </html>[/CODE] SCSS: [CODE=scss]$purple: #5b37b7; $pink: #c33c96; $yellow: #e6a919; $blue: #1194aa; * { box-sizing: border-box; margin: 0; border: 0; padding: 0; } body { background-color: #f7f7f7; display: flex; justify-content: center; align-items: center; min-height: 100vh; font-family: 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif; } .bottom-bar { background-color: #fff; border-bottom-left-radius: 30px; border-bottom-right-radius: 30px; padding: 30px 50px; box-shadow: 0px 20px 90px rgba(50, 50, 50, .3); &--items { display: flex; align-items: center; justify-content: space-between; } &--item { display: flex; align-items: center; justify-content: center; position: relative; padding: 15px 25px; &:not(:last-child) { margin-right: 15px; } &:nth-child(1) { .name {color: $purple;} [type="radio"]:checked { & ~ .icon i {color: $purple;} & ~ label { background-color: rgba($purple, .25);} } } &:nth-child(2) { .name {color: $pink;} [type="radio"]:checked { & ~ .icon i {color: $pink;} & ~ label { background-color: rgba($pink, .25);} } } &:nth-child(3) { .name {color: $yellow;} [type="radio"]:checked { & ~ .icon i {color: $yellow;} & ~ label { background-color: rgba($yellow, .25);} } } &:nth-child(4) { .name {color: $blue;} [type="radio"]:checked { & ~ .icon i {color: $blue;} & ~ label { background-color: rgba($blue, .25);} } } label { position: absolute; top: 0; left: 0; height: 100%; width: 100%; cursor: pointer; border-radius: 30px; flex: none; background-color: rgba(255, 255, 255, 0); transition: background-color .15s ease-in-out; } [type="radio"] { display: none; position: absolute; top: 0; left: 0; height: 0; width: 0; -webkit-appearance: none; flex: none; &:checked { & ~ .name { margin-left: 15px; display: block; width: 100%; } } } .icon { i { color: #000; font-size: 24px; } } .name { font: { weight: 600; size: 16px; } width: 0%; margin-left: -15px; overflow: hidden; transition: all .5s ease-in-out; } } }[/CODE] Hope you like [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
Google Bottom Bar Navigation Pattern
Top