Global function plugins
Many popular plugins provide new global functions within the jQuery namespace. This pattern is common when plugins supply features that are not related to the DOM elements on the page and thus are not good candidates for standard jQuery methods. For example, the Cookie plugin (https://github.com/carhartl/jquery-cookie) offers an interface for reading and writing cookie values on a page. This functionality is provided through the $.cookie() function, which can get or set individual cookies.
Let's say, for example, that we want to remember when users press our slideshow's Pause button so that we can keep it paused if they leave the page and return to it later. After loading the Cookie plugin, reading a cookie is as simple ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access