Ajaxinate
Ajaxinate copied to clipboard
View less button
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 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.
@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 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.