Animation on song remove, song add

This commit is contained in:
Kasper Rynning-Tønnesen
2017-06-16 15:42:07 +02:00
parent 083cc921a1
commit 7e8136752b
6 changed files with 40 additions and 8 deletions

View File

@@ -6,6 +6,13 @@
height: 100% !important;
}
.side_away {
-webkit-transition: all .3s !important;
-moz-transition: all .3s !important;
-o-transition: all .3s !important;
transition: all .3s !important;
}
.card{
cursor:pointer;
background-color: rgba(255, 255, 255, 0.04) !important;

View File

@@ -1057,6 +1057,13 @@ hide mdi-action-visibility mdi-action-visibility-off
top:20px;
}
.side_away {
-webkit-transition: all .3s !important;
-moz-transition: all .3s !important;
-o-transition: all .3s !important;
transition: all .3s !important;
}
.video-container{
-webkit-transition: opacity 0.5s;
-moz-transition: opacity 0.5s;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -78,7 +78,10 @@ var List = {
}
if(transition){
setTimeout(function(){
$(added).css("height", List.element_height);
$(added).css("transform", "translateX(0%)");
setTimeout(function() {
$(added).removeClass("side_away");
}, 300);
},5);
}
}
@@ -319,7 +322,7 @@ var List = {
try{
var index = List.getIndexOfSong(deleted);
var to_delete = $("#wrapper").children()[index];
if(!removed) to_delete.style.height = 0;
//if(!removed) to_delete.style.height = 0;
if(index < List.page && $("#wrapper").children().length - (List.page + 2) >= 0){
$($("#wrapper").children()[List.page]).css("height", 0);
@@ -353,7 +356,17 @@ var List = {
//}, 305);
//if(removed) {
if(List.page <= index && List.page - List.can_fit <= index) {
$("#" + deleted).addClass("side_away");
$("#" + deleted).css("transform", "translateX(-100%)");
setTimeout(function() {
$("#" + deleted).remove();
}, 300);
} else {
$("#"+deleted).remove();
}
//$("#"+deleted).remove();
full_playlist.splice(List.getIndexOfSong(deleted), 1);
Player.sendNext({title: full_playlist[0].title, videoId: full_playlist[0].id});
//}
@@ -824,8 +837,11 @@ var List = {
var attr;
var del_attr;
//song.find(".list-song");
if(transition) song.find("#list-song").css("height", 0);
else song.find(".list-song").css("height", List.element_height);
if(transition) {
song.find(".list-song").css("transform", "translateX(-100%)");
song.find(".list-song").addClass("side_away");
}
song.find(".list-song").css("height", List.element_height);
if(!w_p) song.find(".card-action").removeClass("hide");
if(video_votes == 1)song.find(".vote-text").text("vote");
if(lazy){

View File

@@ -1573,8 +1573,10 @@ $(document).on( "click", "#add-many", function(e){
});
$(document).on( "click", ".vote-container", function(e){
var id = $(this).attr("data-video-id");
List.vote(id, "pos");
if(!$(this).parent().hasClass("side_away")) {
var id = $(this).attr("data-video-id");
List.vote(id, "pos");
}
});
$(document).on( "click", ".delete_button", function(e){