Reputation: 107
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
Can someone break this code down a little to explain (I'm just concerned with slider not, not cookies)
Are there tutorials/books that show how to write/understand jQuery code written in this manner.
Upvotes: 3
Views: 183
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