我有一个测试网站,有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