From 01568effe628691a0ccd7bd23b0f09543fe831b8 Mon Sep 17 00:00:00 2001 From: Yudhi Satrio Date: Thu, 28 Mar 2019 17:01:59 +0700 Subject: [PATCH 1/2] Make instruction elements part more clear on readme --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6770b2b..58c9808 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,10 @@ appear({ }, elements: function elements(){ // work with all elements with the class "track" - return document.getElementsByClassName('track'); + // make sure that the return value is array (in class context it will always array) + // if only one element return just add "[element]" + // ex: return [document.getElementById('track')]; + return document.getElementsByClassName('track'); // this is for return many elements }, appear: function appear(el){ console.log('visible', el); From 8080d4439a6c450552e07a3a04674e1ba28ee079 Mon Sep 17 00:00:00 2001 From: Yudhi Satrio Date: Thu, 28 Mar 2019 17:05:44 +0700 Subject: [PATCH 2/2] Add more clear information about elements part --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 58c9808..879a7ae 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Include appear.js in your page, it has no dependencies. Call `appear()` passing in an object with the following: - `init` function to run when dom is interactive, but before appear.js has started tracking. -- `elements` *required* function that returns an htmlcollection of elements to track. The dom will be interactive at this point. Can alternatively be an existing htmlcollection instead of a function. +- `elements` *required* function that returns an htmlcollection of elements to track. The dom will be interactive at this point. Can alternatively be an existing htmlcollection instead of a function. Please make sure the value is array based, explain below on example part. - `appear` function to run when an element is in view, passed the element that has come into view. If defined then appear.js will track elements until they come into view. - `disappear` function to run when an element goes out of view, passed the element that has gone out of view. If defined then appear.js will track elements until they go out of view. - `reappear` if true appear.js will keep tracking elements for successive appears and dissappears. Default is false.