Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion

Lorenzo Pieri
Lorenzo Pieri
19,772 Points

A question about JS and Mobiles

It might seem like a stupid question but I couldn't find any precise answers to this, so here we go:

I was tinkering with a Club design that I've been trying to complete, just for portfolio's sake, and I started with a "Mobile-First" approach. This given, I created the navigation menu and as usual in late web design, the nav elements are hidden unless you push this very navigation button (Hamburger or whatever, ill choose later).

One of the first lessons taught us that we have to think about users that do not use javascript\jquery on their computers, so we have to build our websites with a method of "Graceful degradation". Im ok with that, it just seems a legitimate way to work! The problem comes with mobiles.

Building a design for mobiles with a width that goes from 320 to 768 had me questioning the ways I can use to build a web-safe website. I could do the navigation menu hide and show with CSS3 Properties only, using pseudo-selectors and so on, but the question is:

can the user actually disable javascript\jquery from its mobile?

If the answer came to be a NO in 99.99% of the cases, why not design a mobile-first approach with jQuery built in, without any graceful fall backs, since jQuery \ Javascript will work anyway on those devices?

Awaiting for responses! :)

And Thanks!

1 Answer

Alan Johnson
Alan Johnson
7,625 Points

Great take on things. We actually do rely on JavaScript here at Treehouse on our site (a different team builds the app than teaches for us, and sometimes we have to be pragmatic). We rely on it because a massive percentage of our students have it turned on, and because a lot of the experiences we want to provide on the site, especially code challenges, just aren't possible without JavaScript.

I think your observation, especially concerning JavaScript and mobile, is spot on. There are, though, still benefits to graceful degradation and thinking about your site without JavaScript. What if a site visitor has JavaScript on, but your server fails to deliver the JavaScript file? If you've designed to degrade gracefully, the site continues working, just with a degraded experience.

Lorenzo Pieri
Lorenzo Pieri
19,772 Points

Too bad I cannot upvote you XD Thank you very much for the answer. It is true: we could avoid graceful degradation when thinking about mobiles (at least 99% of the time) but we can never be amazed if somehow the server fails to send the responses needed for the page to load, be it js requests or any other server-side language requests!

A good answer indeed!