我試圖將smoothState.js嵌入到我的項目中,但出於任何原因,reverse/toogle/exiting動畫無法正常工作。 我真的沒有更多的想法,我找不到在stackoverflow或其他東西的解決方案。Smoothstate.js逆向動畫無法正常工作
我的代碼:
HTML:
<div id="main" class="m-scene">
<!-- Classes that define elment animations -->
<a href="index.html">Home</a>
<a href="about.html">About</a>
<div class="scene_element scene_element--fadeinright">
<p>Home to the boy</p>
</div>
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="js/jquery.smoothState.js"></script>
<script src="js/functions.js"></script>
CSS:(鏈接到CSS文件,包括在包smoothstate的)
JS:
$(function(){
'use strict';
var $page = $('#main'),
options = {
debug: true,
prefetch: true,
cacheLength: 2,
onStart: {
duration: 250, // Duration of our animation
render: function ($container) {
// Add your CSS animation reversing class
$container.addClass('is-exiting');
// Restart your animation
smoothState.restartCSSAnimations();
}
},
onReady: {
duration: 0,
render: function ($container, $newContent) {
// Remove your CSS animation reversing class
$container.removeClass('is-exiting');
// Inject the new content
$container.html($newContent);
}
}
},
smoothState = $page.smoothState(options).data('smoothState');
});
我真的希望有人能幫助我得到這個東西:) :)
預先感謝您。
我正在經歷同樣的事情,我不知道爲什麼它不能逆轉,#main沒有得到任何人可以幫我們在這裏? –
沒有人可以幫助我們嗎?我陷入絕望:/ – Dennis
是的,困惑。我做了所有與文檔所說的一樣的東西,以及我可以看到的代碼,我們基本上都做了同樣的事情,當我看到我的控制檯時,我確實已經退出了工作。但不會做相反的事情,也許是用css動畫的東西? –