From: zurbchris Date: Wed, 18 Nov 2015 06:46:41 +0000 (-0800) Subject: adds programmatic usage info/examples X-Git-Tag: v6.0.0^2~24^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9775836337d18a04d122d15d3a62f6fd2274f44;p=thirdparty%2Ffoundation%2Ffoundation-sites.git adds programmatic usage info/examples --- diff --git a/docs/pages/javascript.md b/docs/pages/javascript.md index 5ed5f65a2..fd62b0476 100644 --- a/docs/pages/javascript.md +++ b/docs/pages/javascript.md @@ -112,9 +112,17 @@ var $accordion = new Foundation.Accordion($('#accordion'), { }); ``` -Most plugins have a public API that allows you to manipulate it through JavaScript. Refer to a plugin's documentation to learn how it works. +Most plugins have a public API that allows you to manipulate it through JavaScript. Refer to a plugin's documentation to learn what functions are available. Invoking methods is easy as pie: - +```js +$('#reveal').foundation('open'); //will open a Reveal modal with id `reveal`. + +$('[data-tabs]').eq(0).foundation('selectTab', $('#example')); //will change the first Tabs on the page to whatever panel you choose. + +$('.tooltip').foundation('destroy'); //will destroy all Tooltips on the page. + +``` +You can use any jQuery selector you like, and if the selector encompasses multiple plugins, they will all have the same the chosen method invoked. You pass arguments just like you would any in other JavaScript `function(comma, delimited, so, easy)`. We did make an effort to reduce the number of public methods that require arguments, but check the plugin's page to see if it requires additional information.

Plugin methods prefixed with an underscore are considered part of the internal API, which means they could change, break, or disappear without warning. We recommend sticking to only the public API, which is documented on each plugin's page.