In this conclusion to a nine-part series on Progressive Enhancement, we'll take the drop-down menu that we designed in the previous part and make its behavior dynamic with the addition of jQuery's "animate()" method. Users with JavaScript disabled on their browsers, however, will still be able to make complete use of the menu.
Dynamic Drop-down Menus: Javascript Progressive Enhancement - The menu’s full source code (Page 4 of 4 )
As I said in the earlier segment, below is the web page containing the full source code of this sample drop-down menu, which this time includes the jQuery snippet defined previously. Check it out:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse auctor commodo risus, et ultrices sapien vestibulum non. Maecenas scelerisque quam a nulla mattis tincidunt. Etiam massa libero, pharetra vel laoreet et, ultrices non leo. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed posuere ullamcorper lacus et sollicitudin. Morbi ultrices condimentum lacus, sit amet venenatis purus bibendum sit amet. Quisque rhoncus sodales sapien ac blandit. Nam lacus urna, commodo eget tincidunt vitae, ullamcorper at nulla. Vivamus ac iaculis justo. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam erat volutpat. Sed quis elit erat, et ultricies diam. Phasellus non turpis malesuada erat ultrices tincidunt sed vitae magna. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Duis purus risus, lacinia at faucibus id, luctus nec diam. In nulla neque, consequat ac hendrerit ac, pulvinar eu dui. Aenean in arcu felis, non hendrerit est.</p>
</div>
<div id="footer">
<h2>Footer section</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse auctor commodo risus, et ultrices sapien vestibulum non. Maecenas scelerisque quam a nulla mattis tincidunt. Etiam massa libero, pharetra vel laoreet et, ultrices non leo. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed posuere ullamcorper lacus et sollicitudin. Morbi ultrices condimentum lacus, sit amet venenatis purus bibendum sit amet. Quisque rhoncus sodales sapien ac blandit. Nam lacus urna, commodo eget tincidunt vitae, ullamcorper at nulla. Vivamus ac iaculis justo. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam erat volutpat. Sed quis elit erat, et ultricies diam. Phasellus non turpis malesuada erat ultrices tincidunt sed vitae magna. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Duis purus risus, lacinia at faucibus id, luctus nec diam. In nulla neque, consequat ac hendrerit ac, pulvinar eu dui. Aenean in arcu felis, non hendrerit est.</p>
</div>
</div>
</body>
</html>
Mission accomplished. At this point, if you give the above web page a try using your own browser, you should see that each section of the menu expands and collapses alternately by using a neat easing effect. Even though the implementation of this animated behavior is indeed an appealing aspect of the menu, by far its most relevant facet is its accessibility -- it will remain totally functional even if CSS and JavaScript are turned off in the browser.
This speaks for itself about the advantages of utilizing Progressive Enhancement during the development of different web-based user interfaces, even the most flashy ones. So, what are you waiting for? Go ahead and start using PE in your own web projects!
Final thoughts
As you know, nothing lasts forever, and this series is no exception. Hopefully, this humble introduction to using Progressive Enhancement has been an educational experience. You learned how to implement this paradigm in different use cases, ranging from constructing basic image galleries and slide shows, to developing more accessible user interfaces, like the drop-down menu that you just saw.
Like many other facets of modern web design, the implementation of PE is entirely optional; however, if accessibility is one of your primary concerns (and it should be), PE is a methodology that you must consider using from the very beginning.
See you in the next web design tutorial!
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.