This is how I usually handle smooth page transitions, but for some reason it doesn’t work in Hugo. To be more specific, it sometimes works, and sometimes doesn’t, and I can’t figure out why.
As you navigate between different pages, some of them reset smoothly, some don’t, and there doesn’t seem to be a pattern…
As always, your feedback is much appreciated!!!
Base of
<script>
$('#main').addClass('fade-out');
</script>
Individual pages
</script>
$(document).ready(function () {
$('#main').removeClass('fade-out');
});
</script>
CSS
.fade-out {
opacity: 0;
}
#main, #main.fade-out {
transition: all 200ms ease-in-out;
}
I also tried binding ‘myfun()’ to onClick nav events, but it didn’t help. I must be doing something fundamentally wrong or dumb
function myfun() {
$('#main').addClass('fade-out');
$(document).ready(function () {
$('#main').removeClass('fade-out');
});
}