jack
jack

Reputation: 107

jQuery tutorials / books that would teach to write code like this

If I see a cool effect on a website I view the source of jquery and usually I can wrap my head around it ,however, I was looking at the slider for http://www.mckinsey.com and viewed the jQuery source that is used in doing the page slide: http://www.mckinsey.com/assets/dotcom/js/home.js

I can't seem to understand how this jQuery code is written or what it does, though, I do understand that it is written in a better fashion and can be maintained properly since everything is not inside the document.ready() function

Upvotes: 3

Views: 183

Answers (1)

amustill
amustill

Reputation: 5302

This method and others like it are known as 'design patterns'. This particular one appears to be the Command Pattern. The following link has a great explanation of the more popular patterns, why they're useful and code examples:

http://addyosmani.com/resources/essentialjsdesignpatterns/book/

Upvotes: 1

Related Questions