[英]My website home page contents are not loading sequentially
Issue I am making a website in php ,and in its home page i have a video at the top and a carousel below it .问题我正在用 php 制作一个网站,在它的主页上,我在顶部有一个视频,在它下面有一个轮播。 But every time when it loads the carousel loads first and then top video loads .
但是每次加载时,都会先加载轮播,然后再加载顶部视频。 I want to apply the lazy load on carousel, which is an html division .
我想在 carousel 上应用延迟加载,这是一个 html 部门。 Now how can i ensure the sequential loading of content.
现在我如何确保内容的顺序加载。
CODE FOR TOP VIDEO BELOW HEADER IS :-标题下方的顶级视频代码是:-
@extends('front.layouts.main')
@section('content')
<div class="clearfix"></div>
<!-- <script src="<?php echo url('/'); ?>/js/particles.js/particles.js"></script> -->
<div class="tp-banner-container two">
<div class="tp-banner3">
<ul>
<li data-transition="fade" data-slotamount="1" data-masterspeed="500"
data-thumb="http://placehold.it/180x110" data-delay="13000" data-
saveperformance="on"
data-title="Slide 1">
<video playsinline loop muted autoplay class="fullscreen-bg__video">
<source src="/videos/HomePage/Jet_new.mp4" type="video/mp4">
</video>
</li>
</ul>
<!-- <div class="tp-bannertimer"></div> -->
</div>
</div>
CODE FOR CAROUSEL BELOW VIDEO IS :-视频下方的 CAROUSEL 代码是:-
<div class="containerRevolvingBig" >
<div class="carousel" >
<a target="_blank" href="/accessControlPage" loading="lazy">
<div id="image1" class="carousel__face"><span class="spanRevolving">Access Control</span></div>
</a>
<a target="_blank" href="/perimeterSurveillancePage">
<div id="image2" class="carousel__face"><span class="spanRevolving">Perimeter Surveillance</span></div>
</a>
<a target="_blank" href="/antiDronePage">
<div id="image3" class="carousel__face"><span class="spanRevolving">Anti-Drone</span></div>
</a>
<a target="_blank" href="/peopleVehicleMonitoringPage">
<div id="image4" class="carousel__face"><span class="spanRevolving">People & Vehicle Monitoring</span></div>
</a>
<div id="image5" class="carousel__face"><span class="spanRevolving">APPLICATIONS</span></div>
<a target="_blank" href="/borderSurveillancePage">
<div id="image6" class="carousel__face"><span class="spanRevolving">Border Surveillance</span></div>
</a>
<a target="_blank" href="/spaceAerialSurveillancePage">
<div id="image7" class="carousel__face"><span class="spanRevolving">Space & Aerial Surveillance</span></div>
</a>
<a target="_blank" href="/weaponSightsPage">
<div id="image8" class="carousel__face"><span class="spanRevolving">Weapon Sights</span></div>
</a>
<a target="_blank" href="/vechileMountedPage">
<div id="image9" class="carousel__face"><span class="spanRevolving">Vehicle Mounted Surveillance</span>
</div>
</a>
</div>
</div>
Now I want that, this complete CAROUSEL div should load when the top video loads completely.How should I apply lazy load in this div.现在我想要那个,当顶部视频完全加载时,这个完整的 CAROUSEL div 应该加载。我应该如何在这个 div 中应用延迟加载。
I would suggest your page to have just the video loaded and add a listener to get to know when the video is loaded ( Wait until an HTML5 video loads ) .我建议您的页面只加载视频并添加一个侦听器以了解视频何时加载( 等待 HTML5 视频加载)。 Then inside the listener generate the carrousel with javascript.
然后在侦听器内部使用 javascript 生成轮播。 ( https://www.javascripttutorial.net/dom/manipulating/create-a-dom-element/ ).
( https://www.javascripttutorial.net/dom/manipating/create-a-dom-element/ )。 Finally if you are using a carrousel plugin this will need to be call once the carrousel html has been included into the page.
最后,如果您使用的是 carrousel 插件,则需要在 carrousel html 包含到页面中后调用此插件。
Other solution but i consider is not ideal, could be set creating a view in the backend that just includes the carousel, then in the frontend, inside the same listener described above, you:其他解决方案,但我认为并不理想,可以设置在后端创建一个仅包含轮播的视图,然后在前端,在上述相同的侦听器中,您:
Hope this is clear.希望这很清楚。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.