SlideShare una empresa de Scribd logo
1 de 69
Descargar para leer sin conexión
We can make people happy
with Responsive Navigation Patterns
People want this
“At first I was angry, but then sadness
crept in as I realised that 

I’m never going to be able to read
those m***** f***ing comments”
a user of a popular US news site
!
There are a lot of patterns
Some have been superseded
The Footer Anchor
this menu button

Jumps you to the footer
The Select Menu

this nav bar
turns into a select element
How to make people happy
3 of the top navigation patterns
1. Do (almost) Nothing
2. The Toggle
3. The Flyout
1. Do (almost) Nothing
also known at Top Nav
Do (Almost) Nothing

Pros
Easy to implement
No fancy CSS voodoo
No JavaScript hocus pocus
!

Cons
Doesn’t suit lots of items due to space
Example of Do Nothing

simplebits.com
What we’re going to build
HTML
HTML can be very basic
!

<div class="brand">Logo</div>
!
<nav class="navbar">
<ul class="navbar--items">
<li><a href="home.html">Home</a></li>
...
</ul>
</nav>
!
<div class="content">
<h1>Do Nothing</h1>
...
</div>
CSS
Small screen first
!

.navbar,
.brand {
text-align: center;
}
Align the navigation

.navbar,
.brand {
text-align: center;
}
!
.navbar--items li {
display: inline-block;
}
Scaling up for larger screens
Set a breakpoint for scaling up

@media screen and (min-width: 40em) {
Re-align the brand and navbar
!

@media screen and (min-width: 40em) {
.brand {
float: left;
width: 20%;
}
.navbar {
float: left;
width: 80%;
}
Pad the navigation items
!

@media screen and (min-width: 40em) {
.brand {
float: left;
width: 20%;
}
.navbar {
float: left;
width: 80%;
}
.navbar--items li {
padding-left: 5%;
padding-right: 5%;
}
}
Putting it all together
!
The Toggle
The Toggle

Pros
Keeps the user in place
Doesn’t take up room when not in use
Easy to scale up
!

Cons
Small JavaScript dependancy
Animation quality
Example of the toggle

starbucks.com
What we’re going to build
HTML
HTML is almost the same
!

<button class="button-toggle" data-toggle>Menu</button>
!
<div class="brand">Logo</div>
!
<nav class="navbar">
<ul class="navbar--items">
...
</ul>
</nav>
...
JS
Determine the type of event
var click = 'click';

!

if (document.documentElement.hasOwnProperty('ontouchstart')) {
click = 'touchstart';
}
Select the elements with the attribute
var click = 'click';

!

if (document.documentElement.hasOwnProperty('ontouchstart')) {
click = 'touchstart';
}

!

var toggleButtons = document.querySelectorAll('[data-toggle]');
Create a function to toggle the class
var click = 'click';

!

if (document.documentElement.hasOwnProperty('ontouchstart')) {
click = 'touchstart';
}

!

var toggleButtons = document.querySelectorAll('[data-toggle]');

!

function toggle(ev) {
ev.preventDefault();
ev.target.classList.toggle('is-on');
}
Associate the elements with the function
var click = 'click';

!

if (document.documentElement.hasOwnProperty('ontouchstart')) {
click = 'touchstart';
}

!

var toggleButtons = document.querySelectorAll('[data-toggle]');

!

function toggle(ev) {
ev.preventDefault();
ev.target.classList.toggle('is-on');
}

!

/* Put everything togther */
for (var i = 0; i < toggleButtons.length; i = i + 1) {
toggleButtons[i].addEventListener(click, toggle, false);
}
CSS
CSS to hide the navigation
!

.navbar {
max-height: 0;
overflow: hidden;
transition: max-height ease-in 300ms;
}
CSS to show the navigation
!

.navbar {
max-height: 0;
overflow: hidden;
transition: max-height ease-in 300ms;
}
!
.button-toggle.is-on {
background: #222;
}
!
.button-toggle.is-on ~ .navbar {
max-height: 1000px;
}
Scaling up to larger screens
Show the navigation
!

@media screen and (min-width: 40em) {
.navbar {
max-height: 1000px;
}
!
Hide the button
!

@media screen and (min-width: 40em) {
.navbar {
max-height: 1000px;
}
!
.button-toggle {
display: none;
}
Make the navigation display inline
!

@media screen and (min-width: 40em) {
.navbar {
max-height: 1000px;
}
!
.button-toggle {
display: none;
}
!
.navbar--items > li {
display: inline-block;
}
}
Putting it all together
!
Nav Flyout
Nav Flyout

Pros
Lots of space
Wow factor
Popularised by Facebook
!

Cons
Performance
Device support
Hard to scale
Example
!

tenplay.com.au
What we’re going to build
!
HTML
Same as toggle
JS
Same as toggle
CSS
Stretch the navigation
.navbar {
position: fixed;
bottom: 0;
right: 0;
top: 0;
width: 66%;
padding-top: 3em;

!
Translate the navigation out the way
.navbar {
position: fixed;
bottom: 0;
right: 0;
top: 0;
width: 66%;
padding-top: 3em;
transform: translate(100%, 0);
}
Set a transition on the elements we’ll move
.navbar {
position: fixed;
bottom: 0;
right: 0;
top: 0;
width: 66%;
padding-top: 3em;
transform: translate(100%, 0);
}

!

.navbar,
.content,
.brand {
transition: transform ease-in 300ms;
}
Move the menu and content on toggle
.navbar {
position: fixed;
bottom: 0;
right: 0;
top: 0;
width: 66%;
padding-top: 3em;
transform: translate(100%, 0);
}

!

.navbar,
.content,
.brand {
transition: transform ease-in 300ms;
}
.content,
.button-toggle.is-on ~ .navbar {
transform: translate(0, 0);
}
.button-toggle.is-on ~ .brand,
.button-toggle.is-on ~ .content {
transform: translate(-66%, 0);
}
Scaling up to larger screens
Re-align things like with do nothing
!

@media screen and (min-width: 40em) {
.button-toggle {
display: none;
}
.brand {
float: left;
width: 15%;
}
.navbar {
position: relative;
width: 85%;
padding-top: 0;
float: left;
}
.navbar--items li {
display: inline-block;
padding: 0 1.5%;
}
Ensure the menu is always visible
!

!

}

.navbar,
.brand,
.button-toggle.is-on ~ .brand,
.button-toggle.is-on ~ .content {
transform: translate3d(0, 0, 0);
}
Putting it all together
!
Dealing with larger nav
Extending the toggle
Avoid the sub navigation
Things to bear in mind
Make navigation items a 

decent size
Make navigation items a
decent size
Use this
Use the devices 

you are targeting
Where can people reach
Resources
All the code used in this presentation
github.com/dp-lewis/respond
!

Heaps of info about RWD
bradfrost.github.io/this-is-responsive
!

Easy to reach places on devices
lukew.com/ff/entry.asp?1649
!

Standardising the Icon
bit.ly/standardise-icon
Thank you
@dp_lewis

Más contenido relacionado

La actualidad más candente

Wix web design tutorial
Wix web design tutorialWix web design tutorial
Wix web design tutorialwgraham1323
 
Rapid Testing, Rapid Development
Rapid Testing, Rapid DevelopmentRapid Testing, Rapid Development
Rapid Testing, Rapid Developmentmennovanslooten
 
Responsive Web Design: Tips and Tricks
Responsive Web Design: Tips and TricksResponsive Web Design: Tips and Tricks
Responsive Web Design: Tips and TricksGautam Krishnan
 
Responsive Design for Digital VU Month 2011
Responsive Design for Digital VU Month 2011Responsive Design for Digital VU Month 2011
Responsive Design for Digital VU Month 2011Ryan Huber
 
How to find the highest paid writing jobs
How to find the highest paid writing jobsHow to find the highest paid writing jobs
How to find the highest paid writing jobsdfreelancer
 
The 5 Layers of Web Accessibility
The 5 Layers of Web AccessibilityThe 5 Layers of Web Accessibility
The 5 Layers of Web AccessibilityDirk Ginader
 
ARTDM 170 Week 3: Rollovers
ARTDM 170 Week 3: RolloversARTDM 170 Week 3: Rollovers
ARTDM 170 Week 3: RolloversGilbert Guerrero
 

La actualidad más candente (8)

Wix web design tutorial
Wix web design tutorialWix web design tutorial
Wix web design tutorial
 
Rapid Testing, Rapid Development
Rapid Testing, Rapid DevelopmentRapid Testing, Rapid Development
Rapid Testing, Rapid Development
 
Responsive Web Design: Tips and Tricks
Responsive Web Design: Tips and TricksResponsive Web Design: Tips and Tricks
Responsive Web Design: Tips and Tricks
 
Responsive Design for Digital VU Month 2011
Responsive Design for Digital VU Month 2011Responsive Design for Digital VU Month 2011
Responsive Design for Digital VU Month 2011
 
How to find the highest paid writing jobs
How to find the highest paid writing jobsHow to find the highest paid writing jobs
How to find the highest paid writing jobs
 
The 5 Layers of Web Accessibility
The 5 Layers of Web AccessibilityThe 5 Layers of Web Accessibility
The 5 Layers of Web Accessibility
 
ARTDM 170 Week 3: Rollovers
ARTDM 170 Week 3: RolloversARTDM 170 Week 3: Rollovers
ARTDM 170 Week 3: Rollovers
 
Vue in Motion
Vue in MotionVue in Motion
Vue in Motion
 

Destacado

Overby mc kenzie_ted_slideshow
Overby mc kenzie_ted_slideshowOverby mc kenzie_ted_slideshow
Overby mc kenzie_ted_slideshowcarrotzcake
 
Mozilla Firefox, Download, Browsing
Mozilla Firefox, Download, BrowsingMozilla Firefox, Download, Browsing
Mozilla Firefox, Download, BrowsingLinda Dwi A II
 
CV dr paresh solanki lattest with KRA
CV dr paresh solanki lattest with KRACV dr paresh solanki lattest with KRA
CV dr paresh solanki lattest with KRAkingmakr1
 
Entrada bloc Reflexió i Innovació
Entrada bloc Reflexió i InnovacióEntrada bloc Reflexió i Innovació
Entrada bloc Reflexió i Innovaciónachomei
 
Does the American Constitution guarantee freedom?
Does the American Constitution guarantee freedom? Does the American Constitution guarantee freedom?
Does the American Constitution guarantee freedom? amibeth26
 
Revenue Ramp Up "Climbing the Mountain" presentation by Michael Godfrey Andrews
Revenue Ramp Up "Climbing the Mountain" presentation by Michael Godfrey AndrewsRevenue Ramp Up "Climbing the Mountain" presentation by Michael Godfrey Andrews
Revenue Ramp Up "Climbing the Mountain" presentation by Michael Godfrey AndrewsRevenue Ramp Up (Project Work - B2B Sales)
 
Extensive Reading: assumptions and experience
Extensive Reading: assumptions and experienceExtensive Reading: assumptions and experience
Extensive Reading: assumptions and experienceKevin Stein
 

Destacado (12)

Overby mc kenzie_ted_slideshow
Overby mc kenzie_ted_slideshowOverby mc kenzie_ted_slideshow
Overby mc kenzie_ted_slideshow
 
Bt2
Bt2Bt2
Bt2
 
MDLOC
MDLOCMDLOC
MDLOC
 
Paradigma crítico..
Paradigma crítico..Paradigma crítico..
Paradigma crítico..
 
Mozilla Firefox, Download, Browsing
Mozilla Firefox, Download, BrowsingMozilla Firefox, Download, Browsing
Mozilla Firefox, Download, Browsing
 
CV dr paresh solanki lattest with KRA
CV dr paresh solanki lattest with KRACV dr paresh solanki lattest with KRA
CV dr paresh solanki lattest with KRA
 
Entrada bloc Reflexió i Innovació
Entrada bloc Reflexió i InnovacióEntrada bloc Reflexió i Innovació
Entrada bloc Reflexió i Innovació
 
Does the American Constitution guarantee freedom?
Does the American Constitution guarantee freedom? Does the American Constitution guarantee freedom?
Does the American Constitution guarantee freedom?
 
Revenue Ramp Up "Climbing the Mountain" presentation by Michael Godfrey Andrews
Revenue Ramp Up "Climbing the Mountain" presentation by Michael Godfrey AndrewsRevenue Ramp Up "Climbing the Mountain" presentation by Michael Godfrey Andrews
Revenue Ramp Up "Climbing the Mountain" presentation by Michael Godfrey Andrews
 
Extensive Reading: assumptions and experience
Extensive Reading: assumptions and experienceExtensive Reading: assumptions and experience
Extensive Reading: assumptions and experience
 
MOVIE
MOVIEMOVIE
MOVIE
 
Topografía miembro superior
Topografía miembro superiorTopografía miembro superior
Topografía miembro superior
 

Similar a Responsive Navigation Patterns - Respond 2014

Responsive & Responsible Web Design in DNN
Responsive & Responsible Web Design in DNNResponsive & Responsible Web Design in DNN
Responsive & Responsible Web Design in DNNgravityworksdd
 
How to Create simple One Page site
How to Create simple One Page siteHow to Create simple One Page site
How to Create simple One Page siteMoneer kamal
 
WordPress Navigation in Responsive Design
WordPress Navigation in Responsive DesignWordPress Navigation in Responsive Design
WordPress Navigation in Responsive Designopenchamp
 
Devices on the Web (2.0)
Devices on the Web (2.0)Devices on the Web (2.0)
Devices on the Web (2.0)Gurpreet Singh
 
Responsive Web Design: From Mobile To Desktop, And Beyond (updated for MobiDe...
Responsive Web Design: From Mobile To Desktop, And Beyond (updated for MobiDe...Responsive Web Design: From Mobile To Desktop, And Beyond (updated for MobiDe...
Responsive Web Design: From Mobile To Desktop, And Beyond (updated for MobiDe...gravityworksdd
 
FrontInBahia 2014: 10 dicas de desempenho para apps mobile híbridas
FrontInBahia 2014: 10 dicas de desempenho para apps mobile híbridasFrontInBahia 2014: 10 dicas de desempenho para apps mobile híbridas
FrontInBahia 2014: 10 dicas de desempenho para apps mobile híbridasLoiane Groner
 
Mobile Monday Presentation: Responsive Web Design
Mobile Monday Presentation: Responsive Web DesignMobile Monday Presentation: Responsive Web Design
Mobile Monday Presentation: Responsive Web DesignCantina
 
SES Toronto 2008; Joe Dolson
SES Toronto 2008; Joe DolsonSES Toronto 2008; Joe Dolson
SES Toronto 2008; Joe DolsonJoseph Dolson
 
Introduction to Jquery
Introduction to JqueryIntroduction to Jquery
Introduction to JqueryAmzad Hossain
 
JavaScript and DOM Pattern Implementation
JavaScript and DOM Pattern ImplementationJavaScript and DOM Pattern Implementation
JavaScript and DOM Pattern Implementationdavejohnson
 
DG Group - Active Or Passive Website
DG Group - Active Or Passive WebsiteDG Group - Active Or Passive Website
DG Group - Active Or Passive WebsiteFranco De Bonis
 
There Are No “Buts” in Progressive Enhancement [Øredev 2015]
There Are No “Buts” in Progressive Enhancement [Øredev 2015]There Are No “Buts” in Progressive Enhancement [Øredev 2015]
There Are No “Buts” in Progressive Enhancement [Øredev 2015]Aaron Gustafson
 
YGLF 2015 - Boom Performance | Eran Zinman (daPulse)
YGLF 2015 -  Boom Performance | Eran Zinman (daPulse)YGLF 2015 -  Boom Performance | Eran Zinman (daPulse)
YGLF 2015 - Boom Performance | Eran Zinman (daPulse)Eran Zinman
 
BOOM Performance
BOOM PerformanceBOOM Performance
BOOM Performancedapulse
 
Create Responsive Website Design with Bootstrap 3
Create Responsive Website Design with Bootstrap 3Create Responsive Website Design with Bootstrap 3
Create Responsive Website Design with Bootstrap 3Wahyu Putra
 

Similar a Responsive Navigation Patterns - Respond 2014 (20)

Responsive & Responsible Web Design in DNN
Responsive & Responsible Web Design in DNNResponsive & Responsible Web Design in DNN
Responsive & Responsible Web Design in DNN
 
How to Create simple One Page site
How to Create simple One Page siteHow to Create simple One Page site
How to Create simple One Page site
 
Boot strap
Boot strapBoot strap
Boot strap
 
WordPress Navigation in Responsive Design
WordPress Navigation in Responsive DesignWordPress Navigation in Responsive Design
WordPress Navigation in Responsive Design
 
Devices on the Web (2.0)
Devices on the Web (2.0)Devices on the Web (2.0)
Devices on the Web (2.0)
 
Responsive Web Design: From Mobile To Desktop, And Beyond (updated for MobiDe...
Responsive Web Design: From Mobile To Desktop, And Beyond (updated for MobiDe...Responsive Web Design: From Mobile To Desktop, And Beyond (updated for MobiDe...
Responsive Web Design: From Mobile To Desktop, And Beyond (updated for MobiDe...
 
FrontInBahia 2014: 10 dicas de desempenho para apps mobile híbridas
FrontInBahia 2014: 10 dicas de desempenho para apps mobile híbridasFrontInBahia 2014: 10 dicas de desempenho para apps mobile híbridas
FrontInBahia 2014: 10 dicas de desempenho para apps mobile híbridas
 
Mobile Monday Presentation: Responsive Web Design
Mobile Monday Presentation: Responsive Web DesignMobile Monday Presentation: Responsive Web Design
Mobile Monday Presentation: Responsive Web Design
 
Accessible code-patterns
Accessible code-patternsAccessible code-patterns
Accessible code-patterns
 
SES Toronto 2008; Joe Dolson
SES Toronto 2008; Joe DolsonSES Toronto 2008; Joe Dolson
SES Toronto 2008; Joe Dolson
 
JavaScript
JavaScriptJavaScript
JavaScript
 
JavaScript
JavaScriptJavaScript
JavaScript
 
Introduction to Jquery
Introduction to JqueryIntroduction to Jquery
Introduction to Jquery
 
JavaScript and DOM Pattern Implementation
JavaScript and DOM Pattern ImplementationJavaScript and DOM Pattern Implementation
JavaScript and DOM Pattern Implementation
 
DG Group - Active Or Passive Website
DG Group - Active Or Passive WebsiteDG Group - Active Or Passive Website
DG Group - Active Or Passive Website
 
There Are No “Buts” in Progressive Enhancement [Øredev 2015]
There Are No “Buts” in Progressive Enhancement [Øredev 2015]There Are No “Buts” in Progressive Enhancement [Øredev 2015]
There Are No “Buts” in Progressive Enhancement [Øredev 2015]
 
YGLF 2015 - Boom Performance | Eran Zinman (daPulse)
YGLF 2015 -  Boom Performance | Eran Zinman (daPulse)YGLF 2015 -  Boom Performance | Eran Zinman (daPulse)
YGLF 2015 - Boom Performance | Eran Zinman (daPulse)
 
BOOM Performance
BOOM PerformanceBOOM Performance
BOOM Performance
 
Create Responsive Website Design with Bootstrap 3
Create Responsive Website Design with Bootstrap 3Create Responsive Website Design with Bootstrap 3
Create Responsive Website Design with Bootstrap 3
 
Prototyping + User Journeys
Prototyping + User JourneysPrototyping + User Journeys
Prototyping + User Journeys
 

Último

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 

Último (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 

Responsive Navigation Patterns - Respond 2014

  • 1. We can make people happy with Responsive Navigation Patterns
  • 3. “At first I was angry, but then sadness crept in as I realised that 
 I’m never going to be able to read those m***** f***ing comments” a user of a popular US news site !
  • 4. There are a lot of patterns Some have been superseded
  • 5. The Footer Anchor this menu button Jumps you to the footer
  • 6. The Select Menu this nav bar turns into a select element
  • 7. How to make people happy 3 of the top navigation patterns
  • 8. 1. Do (almost) Nothing 2. The Toggle 3. The Flyout
  • 9. 1. Do (almost) Nothing also known at Top Nav
  • 10. Do (Almost) Nothing Pros Easy to implement No fancy CSS voodoo No JavaScript hocus pocus ! Cons Doesn’t suit lots of items due to space
  • 11. Example of Do Nothing simplebits.com
  • 12. What we’re going to build
  • 13. HTML
  • 14. HTML can be very basic ! <div class="brand">Logo</div> ! <nav class="navbar"> <ul class="navbar--items"> <li><a href="home.html">Home</a></li> ... </ul> </nav> ! <div class="content"> <h1>Do Nothing</h1> ... </div>
  • 15. CSS
  • 16. Small screen first ! .navbar, .brand { text-align: center; }
  • 17. Align the navigation .navbar, .brand { text-align: center; } ! .navbar--items li { display: inline-block; }
  • 18. Scaling up for larger screens
  • 19. Set a breakpoint for scaling up @media screen and (min-width: 40em) {
  • 20. Re-align the brand and navbar ! @media screen and (min-width: 40em) { .brand { float: left; width: 20%; } .navbar { float: left; width: 80%; }
  • 21. Pad the navigation items ! @media screen and (min-width: 40em) { .brand { float: left; width: 20%; } .navbar { float: left; width: 80%; } .navbar--items li { padding-left: 5%; padding-right: 5%; } }
  • 22. Putting it all together !
  • 24. The Toggle Pros Keeps the user in place Doesn’t take up room when not in use Easy to scale up ! Cons Small JavaScript dependancy Animation quality
  • 25. Example of the toggle starbucks.com
  • 26. What we’re going to build
  • 27. HTML
  • 28. HTML is almost the same ! <button class="button-toggle" data-toggle>Menu</button> ! <div class="brand">Logo</div> ! <nav class="navbar"> <ul class="navbar--items"> ... </ul> </nav> ...
  • 29. JS
  • 30. Determine the type of event var click = 'click'; ! if (document.documentElement.hasOwnProperty('ontouchstart')) { click = 'touchstart'; }
  • 31. Select the elements with the attribute var click = 'click'; ! if (document.documentElement.hasOwnProperty('ontouchstart')) { click = 'touchstart'; } ! var toggleButtons = document.querySelectorAll('[data-toggle]');
  • 32. Create a function to toggle the class var click = 'click'; ! if (document.documentElement.hasOwnProperty('ontouchstart')) { click = 'touchstart'; } ! var toggleButtons = document.querySelectorAll('[data-toggle]'); ! function toggle(ev) { ev.preventDefault(); ev.target.classList.toggle('is-on'); }
  • 33. Associate the elements with the function var click = 'click'; ! if (document.documentElement.hasOwnProperty('ontouchstart')) { click = 'touchstart'; } ! var toggleButtons = document.querySelectorAll('[data-toggle]'); ! function toggle(ev) { ev.preventDefault(); ev.target.classList.toggle('is-on'); } ! /* Put everything togther */ for (var i = 0; i < toggleButtons.length; i = i + 1) { toggleButtons[i].addEventListener(click, toggle, false); }
  • 34. CSS
  • 35. CSS to hide the navigation ! .navbar { max-height: 0; overflow: hidden; transition: max-height ease-in 300ms; }
  • 36. CSS to show the navigation ! .navbar { max-height: 0; overflow: hidden; transition: max-height ease-in 300ms; } ! .button-toggle.is-on { background: #222; } ! .button-toggle.is-on ~ .navbar { max-height: 1000px; }
  • 37. Scaling up to larger screens
  • 38. Show the navigation ! @media screen and (min-width: 40em) { .navbar { max-height: 1000px; } !
  • 39. Hide the button ! @media screen and (min-width: 40em) { .navbar { max-height: 1000px; } ! .button-toggle { display: none; }
  • 40. Make the navigation display inline ! @media screen and (min-width: 40em) { .navbar { max-height: 1000px; } ! .button-toggle { display: none; } ! .navbar--items > li { display: inline-block; } }
  • 41. Putting it all together !
  • 43. Nav Flyout Pros Lots of space Wow factor Popularised by Facebook ! Cons Performance Device support Hard to scale
  • 45. What we’re going to build !
  • 46. HTML
  • 48. JS
  • 50. CSS
  • 51. Stretch the navigation .navbar { position: fixed; bottom: 0; right: 0; top: 0; width: 66%; padding-top: 3em; !
  • 52. Translate the navigation out the way .navbar { position: fixed; bottom: 0; right: 0; top: 0; width: 66%; padding-top: 3em; transform: translate(100%, 0); }
  • 53. Set a transition on the elements we’ll move .navbar { position: fixed; bottom: 0; right: 0; top: 0; width: 66%; padding-top: 3em; transform: translate(100%, 0); } ! .navbar, .content, .brand { transition: transform ease-in 300ms; }
  • 54. Move the menu and content on toggle .navbar { position: fixed; bottom: 0; right: 0; top: 0; width: 66%; padding-top: 3em; transform: translate(100%, 0); } ! .navbar, .content, .brand { transition: transform ease-in 300ms; } .content, .button-toggle.is-on ~ .navbar { transform: translate(0, 0); } .button-toggle.is-on ~ .brand, .button-toggle.is-on ~ .content { transform: translate(-66%, 0); }
  • 55. Scaling up to larger screens
  • 56. Re-align things like with do nothing ! @media screen and (min-width: 40em) { .button-toggle { display: none; } .brand { float: left; width: 15%; } .navbar { position: relative; width: 85%; padding-top: 0; float: left; } .navbar--items li { display: inline-block; padding: 0 1.5%; }
  • 57. Ensure the menu is always visible ! ! } .navbar, .brand, .button-toggle.is-on ~ .brand, .button-toggle.is-on ~ .content { transform: translate3d(0, 0, 0); }
  • 58. Putting it all together !
  • 61. Avoid the sub navigation
  • 62. Things to bear in mind
  • 63. Make navigation items a 
 decent size
  • 64. Make navigation items a decent size
  • 66. Use the devices 
 you are targeting
  • 68. Resources All the code used in this presentation github.com/dp-lewis/respond ! Heaps of info about RWD bradfrost.github.io/this-is-responsive ! Easy to reach places on devices lukew.com/ff/entry.asp?1649 ! Standardising the Icon bit.ly/standardise-icon