diff options
author | Rob Loach <robloach@gmail.com> | 2014-10-05 22:29:49 -0400 |
---|---|---|
committer | Rob Loach <robloach@gmail.com> | 2014-10-05 22:29:49 -0400 |
commit | 719639d2e7db76b4f043c6e4b2e5b19bb53c600e (patch) | |
tree | c2f1b435179e56d3d585df85663d74009ea91982 /jquery.once.js | |
parent | 01d2fc3bdcad54258d3a51897bc29426fc3c65dc (diff) | |
download | jquery-once-719639d2e7db76b4f043c6e4b2e5b19bb53c600e.zip jquery-once-719639d2e7db76b4f043c6e4b2e5b19bb53c600e.tar.gz jquery-once-719639d2e7db76b4f043c6e4b2e5b19bb53c600e.tar.bz2 |
Clean up code documentation
Diffstat (limited to 'jquery.once.js')
-rw-r--r-- | jquery.once.js | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/jquery.once.js b/jquery.once.js index 5361c74..dfde181 100644 --- a/jquery.once.js +++ b/jquery.once.js @@ -3,17 +3,6 @@ * @description Act on jQuery elements only once. * @version 2.0.0-alpha.5 * @link http://github.com/robloach/jquery-once - * - * @example - * // Change the color to green only once. - * $('p').once('changecolor', function() { - * $(this).css('color', 'green'); - * }); - * - * @see once - * @see removeOnce - * @see findOnce - * * @author Rob Loach (http://robloach.net) * @license MIT, GPL-2.0 */ @@ -53,6 +42,17 @@ * iteration. * @returns jQuery element collection of elements that have now run once. * + * @example + * // Change the color to green only once. + * $('p').once('changecolor', function() { + * // This function is called for every p element that hasn't been called + * // with "changecolor" once() before. + * $(this).css('color', 'green'); + * }); + * + * @see removeOnce + * @see findOnce + * * @public * @global */ @@ -92,9 +92,18 @@ * follows the same logic as $.each(). Returning true will continue to the * next matched element in the set, while returning false will entirely * break the iteration. + * * @returns jQuery element collection of elements that now have their once * data removed. * + * @example + * // Remove once data with the "changecolor" ID. + * $('p').removeOnce('changecolor', function() { + * // This function is called for all elements that had their once removed. + * }); + * + * @see once + * * @public * @global */ @@ -122,8 +131,17 @@ * logic as $.each(). Returning true will continue to the next matched * element in the set, while returning false will entirely break the * iteration. + * * @returns jQuery element collection of elements that have been run once. * + * @example + * // Find all elements that have the changecolor'ed once. + * $('p').findOnce('changecolor', function() { + * // This function is called for all elements that has already once'd. + * }); + * + * @see once + * * @public * @global */ |