lots of improvements:
hover animation correct jumpback position after video view load when scroll - not all at beginning
This commit is contained in:
parent
90e2f38c04
commit
4ad29fd072
@ -17,10 +17,18 @@
|
||||
margin: 1%;
|
||||
background-color: #7F7F7F;
|
||||
cursor: pointer;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.videopreview:hover {
|
||||
opacity: 1;
|
||||
transition: opacity 0.5s;
|
||||
}
|
||||
|
||||
.previewtitle {
|
||||
height: 10%;
|
||||
}
|
||||
|
||||
.previewpic {
|
||||
height: 90%;
|
||||
}
|
||||
|
12
index.html
12
index.html
@ -2,17 +2,13 @@
|
||||
<html lang="en" dir="ltr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title></title>
|
||||
<title>hub</title>
|
||||
<link rel="stylesheet" href="css/plyr.css"/>
|
||||
<link rel="stylesheet" href="css/index.css">
|
||||
|
||||
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<script src="js/plyr.js"></script>
|
||||
|
||||
<script>
|
||||
|
||||
</script>
|
||||
<script src="js/index.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
@ -21,12 +17,8 @@
|
||||
<div class="closebutton">
|
||||
|
||||
</div>
|
||||
<div class="videowrapper">
|
||||
|
||||
<div class="videowrapper"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="previewcontainer">
|
||||
|
44
js/index.js
44
js/index.js
@ -1,31 +1,51 @@
|
||||
$(document).ready(function() {
|
||||
console.log("finished loading page");
|
||||
$.post('php/videoload.php','action',function(data){
|
||||
console.log(data);
|
||||
for (var i in data) {
|
||||
if (data[i] != "." && data[i] != "..") {
|
||||
//loadVideo("videos/prn/"+data[i],"");
|
||||
loadPreview(data[i]);
|
||||
console.log(data[i]);
|
||||
}
|
||||
var videos;
|
||||
var loadindex = 0;
|
||||
var scrollposition = 0;
|
||||
|
||||
}
|
||||
$(document).ready(function () {
|
||||
$.post('php/videoload.php', 'action', function (data) {
|
||||
videos = data;
|
||||
loadPreviewBlock(12);
|
||||
}, 'json');
|
||||
//loadVideo("https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-1080p.mp4",'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.jpg');
|
||||
|
||||
$(".closebutton").click(function () {
|
||||
$(".videopagewrapper").hide();
|
||||
$(".previewcontainer").show();
|
||||
// scroll back to last scroll position
|
||||
$(window).scrollTop(scrollposition);
|
||||
$(".videowrapper").html("");
|
||||
});
|
||||
});
|
||||
|
||||
$(window).scroll(function () {
|
||||
if ($(window).scrollTop() >= (($(document).height() - $(window).height() - 60))) {
|
||||
if ($(".videowrapper").html() == "") {
|
||||
loadPreviewBlock(6);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function loadPreviewBlock(nr) {
|
||||
for (let i = 0; i < nr; i++) {
|
||||
if (loadindex + i < videos.length) {
|
||||
if (videos[loadindex + i] != "." && videos[loadindex + i] != "..") {
|
||||
loadPreview(videos[loadindex + i]);
|
||||
} else {
|
||||
nr++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
loadindex += nr;
|
||||
}
|
||||
|
||||
function loadPreview(src) {
|
||||
var preview = $("<div class='videopreview'><div class='previewtitle'>" + src + "</div><div class='previewpic'><img style='width:100%;height:100%' src=\"videos/thumbnails/" + src + ".jpg\" alt='no thumbnail found'></img></div></div>");
|
||||
preview.attr('videourl', "videos/prn/" + src);
|
||||
preview.attr('thumbnailurl', "videos/thumbnails/" + src);
|
||||
preview.click(function () {
|
||||
console.log("preview clicked");
|
||||
scrollposition = $(window).scrollTop();
|
||||
loadVideo($(this).attr("videourl"), $(this).attr("thumbnailurl") + ".jpg");
|
||||
});
|
||||
$(".previewcontainer").append(preview);
|
||||
|
@ -6,7 +6,6 @@ $password = "3MnDApF3bu6XDGOE";
|
||||
$database = "mwitdb";
|
||||
|
||||
$mysqli = new mysqli($server, $user, $password, $database);
|
||||
if($mysqli->connect_errno)
|
||||
{
|
||||
if ($mysqli->connect_errno) {
|
||||
echo "connecton failed... nr: " . $mysqli->connect_errno . " -- " . $mysqli->connect_error;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user