I have html and css working with the simplest using smoothState.js
;(function ($) { $('#main').smoothState(); })(jQuery);
However, even with this basic implementation, if you select a link to the current page (for example, reload the page), you will get a blank white screen with 2015 written in the upper left corner. with this error The error is not written to the console , which makes me think about the error with smoothState.js
If I extend to smoothState to use more advanced parameters (ie "is-exiting"), now it becomes impossible to navigate the site, navigate the page.
With the extended implementation shown at the end of this question, I get a console error:
Uncaught TypeError: content.toggleAnimationClass is not a function main.js:134 $.smoothState.onStart.render @ main.js:134 load @ jquery.smoothState.js:533 clickAnchor @ jquery.smoothState.js:589 n.event.dispatch @ jquery.min.js:3 n.event.add.r.handle @ jquery.min.js:3
Here's the html :
<head></head> <body> <div id="main" class="m-scene"> <header id="header"> </header> <div id="page_content_container" class="scene_element scene_element--moveUpIn"> <section class="about-intro-container"> </section> <section class="about-services-container"> </section> <section class="about-randomBits-container"> </section> <footer> </footer> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script src="js/jquery.smoothState.js"></script> <script src="js/main.js"></script> </body> </html>
Here smoothState corresponds to css :
.m-scene .scene_element { animation-duration: .5s; transition-timing-function: ease-in; animation-fill-mode: both; } .m-scene .scene_element--moveUpIn { animation-name: moveUp, fadeIn; } .m-scene.is-exiting .scene_element { animation-direction: alternate-reverse; } @keyframes moveUp { 0% { transform: translateY(100%) } 100% { transform: translateY(0%) } } @keyframes fadeIn { 0% { opacity: 0; } 100% { opacity: 1; } }
And here is a more advanced smoothState:
;(function($) { 'use strict'; var $body = $('html, body'), content = $('#main').smoothState({
In the end, I plan to add prefetch , pageCacheSize , etc ... and implement a different transition depending on which page you load / exit. However, at this time, you should not move forward until I can solve the above problems.
Any ideas or help are appreciated and greatly appreciated, Thank you.
Oh, I got this error too
XMLHttpRequest cannot load file:///Users/Parallelos/Developer/paralellos.imtqy.com/projects.html. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource. n.ajaxTransport.k.cors.a.crossDomain.send @ jquery.min.js:4 n.extend.ajax @ jquery.min.js:4 fetch @ jquery.smoothState.js:355 load @ jquery.smoothState.js:529 clickAnchor @ jquery.smoothState.js:589 n.event.dispatch @ jquery.min.js:3 n.event.add.r.handle @ jquery.min.js:3