Coder Social home page Coder Social logo

Comments (5)

luruke avatar luruke commented on May 2, 2024 1

Yo'!
Will add this in the next release!

Thank you

from barba.

luruke avatar luruke commented on May 2, 2024

Hi @ZachSaucier ,
Thank you for your observation!

In the transition, when .done is called the oldContainer is removed from the DOM:

done: function() {
    this.oldContainer.parentNode.removeChild(this.oldContainer);
    this.deferred.resolve();
}

I can add visibility: visible in BaseTransition.done, but actually should be the custom Transition responsible to make to hide the old Container and show the new one.
So, will change nothing, right?

In visibility: hidden, instead of display: none you can access to some property like height/width of the elements, and it's super useful;

You may start a slider or do other JS operation when the newContainer is attached to the DOM and the transition is not yet finished (event onEnter in Views or newPageReadyin Barba.Dispatcher).

Also, with visibility: hidden the browser (at least Chrome) starts preloading the images, so, it's quite handy.

Hope it reply your answer, if yes, feel free to close the issue.

from barba.

ZachSaucier avatar ZachSaucier commented on May 2, 2024

I understand your points and see the value in how it currently runs, but my original points still remain I think 😛

It's not a big deal either way, just what I see as an improvement

from barba.

luruke avatar luruke commented on May 2, 2024

So, basically, your idea is to make the .donefunction like this:

done: function() {
    this.oldContainer.parentNode.removeChild(this.oldContainer);
    this.newContainer.style.visibility = 'visible';
    this.deferred.resolve();
}

Am I right?

If so, the default Transition HideShowTransition can be rewritten like:

var HideShowTransition = BaseTransition.extend({
  start: function() {
    this.newContainerLoading.then(this.finish.bind(this));
  },

  finish: function() {
    document.body.scrollTop = 0;
    this.done();
  }
});

from barba.

ZachSaucier avatar ZachSaucier commented on May 2, 2024

Yes, that is the main idea I propose. It keeps things simpler

from barba.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.