私は5ページのテストサイトを持っていますが、それぞれのページの背景色はページによって異なります。smoothState.jsで背景色を変更します
smoothState.jsに付属のデフォルト設定を使用すると、背景色がページの本文に設定されているように更新されません.F5キーを押すとそのページの色が表示されます。 smoothState.jsを使用しているページに応じて背景色を変更することはできますか?
smoothState.jsオプション:
$(function(){
'use strict';
var options = {
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 = $('#main').smoothState(options).data('smoothState');
});
CSS:
.home{
background-color: #000000;
}
.about{
background-color: #efefef;
}
.faq{
background-color: #999999;
}
.prices{
background-color: #666666;
}
.contact{
background-color: #333333;
}
ご返信ありがとうございます!これをありがとう! – user5898548