O'Reilly logo

HTML5 and CSS3 Responsive Web Design Cookbook by Benjamin LaGrone

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Writing "Hello World" unobtrusively

An important facet of responsive design is interaction. As we know that mobile devices and desktops have very different user interfaces, we cannot expect that our JavaScript interaction scripts will work across all devices. An illustrative example is the .mouseover() or mouse hover event listener. The mouse is not attached to a touch screen device, so any misdirected attempt at the .mouseover() event would likely function as a .click() event. The solution to this is to fully remove your interaction script from your templates.

Getting ready

This method is referred to as "Unobtrusive JavaScript". Here, instead of embedding scriptlets like onclick() in your HTML template, you can create an external JavaScript that ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required