I have just discovered Barba.js and find it very useful. It provides smooth transitions between URLs of the same website.
I have put together a
I came out with this version of the script:
$(function(){
var transEffect = Barba.BaseTransition.extend({
start: function() {
this.newContainerLoading.then(val => this.fadeInNewcontent($(this.newContainer)));
},
fadeInNewcontent: function(nc) {
var _this = this;
nc.css('visibility', 'visible');
nc.show().promise().done(() => {
$(this.oldContainer).fadeOut(50);
if (!isMobile.any()) {
$('html, body').delay(100).animate({
scrollTop: 200
},700);
}
});
}
});
Barba.Pjax.getTransition = function() {
return transEffect;
}
Barba.Pjax.start();
});
It is better, but not smooth enough. See the the effect on a real life project. How can I improve it?