Responsive js

15

Click here to load reader

description

Responsive JS in Drupal presentation.

Transcript of Responsive js

Page 1: Responsive js

lastcallmedia.com

[email protected]

@lastcallmedia

RESPONSIVE JAVASCRIPT

Rob Bayliss CTO

Page 2: Responsive js

A BRIEF HISTORY OF JAVASCRIPTCreated in 10 Days Massively Divergent Standards Libraries allow for cross-platform development "Web 2.0" Standards got better It is now ubiquitous

Page 3: Responsive js

WHAT IS RESPONSIVENESS?Serve the same content to everyone, but optimize the appearance based on characteristics of the device that is viewing it.

HTML is the meal CSS/JS are the condiments

Page 4: Responsive js

WHAT IS RESPONSIVENESS?Some things we can respond to: !• Media (print, screen) • Screen (size and orientation) • Capabilities (touch, feature compatibility)

Page 5: Responsive js

THE SIZE PROBLEM

Page 6: Responsive js

RESPONSIVE JAVASCRIPT - TECHNIQUES

Page 7: Responsive js

WINDOW.RESIZE()Trigger a handler ever time the window is resized Performance can be an issue Useful when you have to respond to every single resize Example

Page 8: Responsive js

WINDOW.MATCHMEDIAFire a handler when a specific breakpoint is matched or unmatched. Example

Page 9: Responsive js

WINDOW.MATCHMEDIA

Page 10: Responsive js

PERFORMANCE COMPARISON

http://jsperf.com/matchmedia-vs-resize/2

Page 13: Responsive js

A WORD ON POLYFILLSPolyfills are like back ported functionality for older/less functional browsers. The best ones work with no extra calls or interactions needed. Load them conditionally whenever possible Polyfills are not as performant as real browser support Polyfills

https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-browser-Polyfills

Page 14: Responsive js

RESPONSIVE JS IN DRUPALWatch out for attachment issues. This is one situation where you probably shouldn’t use Drupal.behaviors. Example

Page 15: Responsive js

QUESTIONS?

http://lastcallmedia.com [email protected]

@rbayliss