• Resolved chickendipper

    (@chickendipper)


    Hello,

    Taken from thread: https://www.ads-software.com/support/topic/stop-page-reload-on-ajax-theme-when-loading-result (not sure if you will have seen the response as this was marked resolved).

    Sorry to bother you again. I have come across an issue that happens when using the code to prevent page reloads when using the search.

    What happens is after navigating the site and hitting the back button, the previous page will load but seems to reload a few times.
    The more you navigate around the site and go back the worse this gets and you end up watching the page load endlessly.

    Just wondered if you know why this happens when using the code or if I can stop it?
    I have contacted the theme dev too just in case.

    The complete code is:

    
    	let dom_observer = new MutationObserver(function(mutation) {
    		if ( typeof Pjax != 'undefined' ) {
    			let newContent = document.querySelector(".asl_r");
    			let pjax = new Pjax({
    				       cacheBust: false,
    					   elements: "a", // default is "a[href], form[action]"
    					   selectors: ["title", "#header nav", "#aside", "#footer", "#content"] 
    					});
    			pjax.refresh(newContent);
    			jQuery('.asl_r .item').off('click.body').one('click.body', function(){
    				document.body.click();
    			});
    		}
    	});
    	let	container = document.documentElement || document.body,
    		config = { attributes: false, childList: true, subtree: true, characterData: false };
    	dom_observer.observe(container, config);
    

    Thanks for any advice you can provide.

    • This topic was modified 2 years, 9 months ago by chickendipper.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Stop page reload on ajax theme when loading result’ is closed to new replies.