我正在創建從我的介紹頁面到我的主頁的平滑過渡,因爲您可以在這裏看到http://trial.kareemhackett.com所以我使用了smoothstate.js,但是我無法讓它在頁面之間平滑過渡,我覺得這是因爲我有圖像作爲不同於任何演示的背景。但希望這可能不是我在這裏帶來的情況。也許是因爲我在使用引導程序?smoothstate.js不適用於不同的背景圖片嗎?
這是我的代碼。我也嘗試了reveal.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');
});
.intro {
background: url(img/headerbg.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
width: 100%;
height: 100vh;
}
.site-wrapper {
display: table;
width: 100%;
height: 100%; /* For at least Firefox */
min-height: 100%;
-webkit-box-shadow: inset 0 0 100px rgba(0,0,0,.5);
box-shadow: inset 0 0 100px rgba(0,0,0,.5);
}
.site-wrapper-inner {
display: table-cell;
vertical-align: middle;
}
.cover-container {
margin-right: auto;
margin-left: auto;
}
.inner {
padding: 30px;
}
.cover {
padding: 0 20px;
}
<div id="main" class="m-scene">
<div class="scene_element scene_element--fadeinright">
<div class="intro">
<div class="site-wrapper">
<div class="site-wrapper-inner">
<div class="cover-container">
<div class="inner cover">
<a class="center-block" href="newhome.html" data-transition="fade"><img class="img-responsive" src="img/Bang_logo.png"></a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
我不明白爲什麼,但我有一個令人難以置信的很難得到這個或任何網頁過渡我的這個項目正在進行中。我添加了關鍵幀到這些類,但仍然沒有運氣。 –