Guys, good afternoon! Need an idea. There is a page in which there is such a list:
<ul class="list"> <li class="list-item">Заголовок</li> <video src="videos/v1.mp4" controls></video> <li class="list-item">Заголовок</li> <video src="videos/v1.mp4" controls></video> <li class="list-item">Заголовок</li> <video src="videos/v1.mp4" controls></video> <li class="list-item">Заголовок</li> <video src="videos/v1.mp4" controls></video> <li class="list-item">Заголовок</li> <video src="videos/v1.mp4" controls></video> <li class="list-item">Заголовок</li> <video src="videos/v1.mp4" controls></video> <li class="list-item">Заголовок</li> <video src="videos/v1.mp4" controls></video> <li class="list-item">Заголовок</li> <video src="videos/v1.mp4" controls></video> <li class="list-item">Заголовок</li> <video src="videos/v1.mp4" controls></video> <li class="list-item">Заголовок</li> <video src="videos/v1.mp4" controls></video> <li class="list-item">Заголовок</li> <video src="videos/v1.mp4" controls></video> </ul> There is also a piece of jquery:
$(document).ready(function(){ $('video').hide(); }); $(".list-item").click(function() { $(this).next("video").slideToggle(1000); } ); Which allows clicking on the title (list item) to expand the video below it, and collapse it if it is already maximized.
This list will be displayed via php. But the problem is that when the page opens, the browser hangs very much. Is it possible to somehow optimize all this? I thought to assign the value of the src attribute to the video tag, only after clicking on the title, but I don’t know how to do this, because the paths to the files will be got from the Bd using php.