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%;
|
margin: 1%;
|
||||||
background-color: #7F7F7F;
|
background-color: #7F7F7F;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
opacity: 0.9;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.videopreview:hover {
|
||||||
|
opacity: 1;
|
||||||
|
transition: opacity 0.5s;
|
||||||
|
}
|
||||||
|
|
||||||
.previewtitle {
|
.previewtitle {
|
||||||
height: 10%;
|
height: 10%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.previewpic {
|
.previewpic {
|
||||||
height: 90%;
|
height: 90%;
|
||||||
}
|
}
|
||||||
|
12
index.html
12
index.html
@ -2,17 +2,13 @@
|
|||||||
<html lang="en" dir="ltr">
|
<html lang="en" dir="ltr">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title></title>
|
<title>hub</title>
|
||||||
<link rel="stylesheet" href="css/plyr.css"/>
|
<link rel="stylesheet" href="css/plyr.css"/>
|
||||||
<link rel="stylesheet" href="css/index.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="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||||
<script src="js/plyr.js"></script>
|
<script src="js/plyr.js"></script>
|
||||||
|
|
||||||
<script>
|
|
||||||
|
|
||||||
</script>
|
|
||||||
<script src="js/index.js"></script>
|
<script src="js/index.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -21,12 +17,8 @@
|
|||||||
<div class="closebutton">
|
<div class="closebutton">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="videowrapper">
|
<div class="videowrapper"></div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="previewcontainer">
|
<div class="previewcontainer">
|
||||||
|
44
js/index.js
44
js/index.js
@ -1,31 +1,51 @@
|
|||||||
$(document).ready(function() {
|
var videos;
|
||||||
console.log("finished loading page");
|
var loadindex = 0;
|
||||||
$.post('php/videoload.php','action',function(data){
|
var scrollposition = 0;
|
||||||
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]);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
$(document).ready(function () {
|
||||||
|
$.post('php/videoload.php', 'action', function (data) {
|
||||||
|
videos = data;
|
||||||
|
loadPreviewBlock(12);
|
||||||
}, 'json');
|
}, '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 () {
|
$(".closebutton").click(function () {
|
||||||
$(".videopagewrapper").hide();
|
$(".videopagewrapper").hide();
|
||||||
$(".previewcontainer").show();
|
$(".previewcontainer").show();
|
||||||
|
// scroll back to last scroll position
|
||||||
|
$(window).scrollTop(scrollposition);
|
||||||
$(".videowrapper").html("");
|
$(".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) {
|
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>");
|
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('videourl', "videos/prn/" + src);
|
||||||
preview.attr('thumbnailurl', "videos/thumbnails/" + src);
|
preview.attr('thumbnailurl', "videos/thumbnails/" + src);
|
||||||
preview.click(function () {
|
preview.click(function () {
|
||||||
console.log("preview clicked");
|
console.log("preview clicked");
|
||||||
|
scrollposition = $(window).scrollTop();
|
||||||
loadVideo($(this).attr("videourl"), $(this).attr("thumbnailurl") + ".jpg");
|
loadVideo($(this).attr("videourl"), $(this).attr("thumbnailurl") + ".jpg");
|
||||||
});
|
});
|
||||||
$(".previewcontainer").append(preview);
|
$(".previewcontainer").append(preview);
|
||||||
|
@ -6,7 +6,6 @@ $password = "3MnDApF3bu6XDGOE";
|
|||||||
$database = "mwitdb";
|
$database = "mwitdb";
|
||||||
|
|
||||||
$mysqli = new mysqli($server, $user, $password, $database);
|
$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;
|
echo "connecton failed... nr: " . $mysqli->connect_errno . " -- " . $mysqli->connect_error;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user