S
S
sasha_jarvi2019-04-02 18:45:11
css
sasha_jarvi, 2019-04-02 18:45:11

How to make an element disappear on page load?

I have the following jquery code:

window.onload = function(){
   $('#preloader').fadeOut('slow', function() {});
};

We need to make an analog using vue.

The element is done like this:

<transition name="fade">
    <div id="preloader" v-if="show">
        <i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i>
    </div>
</transition>


javascript:

var preloader = new Vue({
    el: '#preloader',
    data: {
        show: true
    }
});

How to make an element disappear on page load? I did not find a direct analogue of fadeOut in jquery in the documentation.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2019-04-02
@sasha_jarvi

.fade-leave-active {
  transition: opacity 1s;
}

.fade-leave-to {
  opacity: 0;
}

mounted() {
  this.show = false;
},

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question