Freetile
Freetile copied to clipboard
How to append items
Hello,
I do like Freetile very much, but as the content of my site grows, it is getting harder to keep it clear and I would like to append additional items only on page scroll or by clicking a button. I've read the few threads I could find but have not been able so far to get it to work using contentToAppend: 'whateveryourselectoris'
Could you please provide a working example?
Hello, anybody out there? I'd really appreciate an answer on this – honestly.
User in trouble – please reply!
Hi,
appending is done like so: $('#container').freetile({ contentToAppend: '.newElementsClass' });
what sort of problem do you encounter?
Hello yconst, So good you reply, thanks! The problem I encounter is that I don't know how to apply the «new elements class». I've tried and applied a class to all items (i. e. figures) that would appear on the next page with pagination working. But nothing is loaded when I scroll down to the end of the page nor do I know how to load the next items by button. Could you please provide a working example with scrolling or button? I think I could then figure it out and won't bother you anymore.
Hi,
Freetile does not handle automatic loading of new elements when scrolling down. It only handles appending them to the collection, but you should make sure that the elements actually exist (create them), and then call the fertile method, with the contentToAppend parameter. Sorry, but I don't have a working example at hand to share. However, you may find many examples on the web by searching for "Infinite Scroll"
Hello yconst,
(…) you should make sure that the elements actually exist (create them) They do exist. Yet they're invisible and I want to append them on click.
then call the fertile method, with the contentToAppend parameter This is exactly what I don't understand. How can I achieve this?
I only contacted you after some really deep googling which didn't get me any further. I am still quite a novice to JS and I WANT to understand. Could you give a code example then showing what to add to the contentToAppend parameter? (Simple insert of the appendable items class or id does not work.)