Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How About Loading the Whole Document #372

Open
nazimwibsoft opened this issue Jan 25, 2019 · 1 comment
Open

How About Loading the Whole Document #372

nazimwibsoft opened this issue Jan 25, 2019 · 1 comment

Comments

@nazimwibsoft
Copy link

nazimwibsoft commented Jan 25, 2019

There should be a way in the Soothstate js to load the whole document if one need to? so we dont have to specify container Id it will just reload the whole content. I did some experiment and had to modify the script a bit.

I used this small piece of code to replace HTML content of whole document:
document.open("text/html", "replace");
document.write(data);
document.close();

This will execute all my scripts correctly and load the page like we normally do but with a transition giving user a transition experience without reload the page.

** onReady will be Like this **

onReady: {
duration: 0,
render: function ($container, $newContent) {

                $container.removeClass('is-exiting');

                var currentUrl = $container.data('smoothState').href;
                var cache = $container.data('smoothState').cache;

                var currentPageCache = cache[currentUrl];

                document.open("text/html", "replace");
                document.write(currentPageCache.doc);
                document.close();
            }
        }
@thunderpigeon
Copy link

I couldn't get it to work. But, would be sweet if it did.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants