I have 3 hero images and their content and I want to display them randomly when user refreshes the page!
Basically I am trying to display random div using Jquery on loading page, but issue is that the size of hero image is large and by using Jquery, all these 3 images start loading in DOM which affects the speed of page.
Is there any solution for this in Vue.js for loading that one specific div at a time, not all 3 divs when user refreshes the page!?
<div class="slider-item"> <img src="../../../static/img/slides/slide1.png" alt="Hello">
<div class="carousel-caption">
<h2>Lipsum Heading</h2>
<h4>Lipsum dummy content body test dummy goes here.</h4>
</div>
</div>
jQuery Code:
mounted()
{
var random = Math.floor(Math.random() * $('.slider-item').length);
$('.slider-item').eq(random).show();
},