Ajaxinate icon indicating copy to clipboard operation
Ajaxinate copied to clipboard

View less button

Open lesterdefreitas opened this issue 5 years ago • 3 comments

I am not 100% sure how the destroy function works, so please forgive me if this is a but of a silly question, but I want to be able to create a "View less" button that basically removes all of the additional pages that you have made visible with the "View more" button. Ideally the functionality to click "View more" again should still be there after clicking "View less" I suppose.

Anyone got any ideas on how to do this and if it is possible with this solution?

lesterdefreitas avatar May 14 '19 07:05 lesterdefreitas

@lesterdefreitas interesting idea! You could remove the extra content easily enough, but telling the plugin to add the right content again if the user requests it again wouldn't work unless you modified the getTheHtmlOfTheNextPageWithAnAjaxRequest function.

Cam avatar May 21 '19 02:05 Cam

@lesterdefreitas interesting idea! You could remove the extra content easily enough, but telling the plugin to add the right content again if the user requests it again wouldn't work unless you modified the getTheHtmlOfTheNextPageWithAnAjaxRequest function.

Ok, good to know! Could you maybe explain how I could add a button that would remove all of the loaded content?

lesterdefreitas avatar May 31 '19 10:05 lesterdefreitas

@lesterdefreitas Something along the lines of adding the remove button dynamically after loading the new page content, then listen for a click event on that button. Once triggered you would use something like removeChild(elementID) or innerHTML = '' to remove that new page content.

Cam avatar Jun 14 '19 10:06 Cam