Add sidebar close button.

This commit is contained in:
kovacsv 2021-06-20 10:53:24 +02:00
parent 376a949ba9
commit d5157017c2
3 changed files with 36 additions and 3 deletions

View File

@ -8,10 +8,24 @@ OV.Sidebar = class
constructor (parentDiv)
{
this.parentDiv = parentDiv;
this.callbacks = null;
this.visible = true;
this.titleDiv = $('<div>').addClass ('ov_sidebar_title').appendTo (parentDiv);
this.titleDiv.html ('Details');
this.contentDiv = $('<div>').addClass ('ov_sidebar_content').addClass ('ov_thin_scrollbar').appendTo (parentDiv);
this.titleDiv = null;
this.contentDiv = null;
}
Init (callbacks)
{
this.callbacks = callbacks;
this.titleDiv = $('<div>').addClass ('ov_sidebar_title').appendTo (this.parentDiv);
this.contentDiv = $('<div>').addClass ('ov_sidebar_content').addClass ('ov_thin_scrollbar').appendTo (this.parentDiv);
let titleTextDiv = $('<div>').addClass ('ov_sidebar_title_text').html ('Details').appendTo (this.titleDiv);
let titleImg = $('<img>').addClass ('ov_sidebar_title_img').attr ('src', 'assets/images/sidebar/close.svg').appendTo (this.titleDiv);
let obj = this
titleImg.click (function () {
obj.callbacks.onClose ();
});
}
Show (show)

View File

@ -271,6 +271,19 @@ div.ov_sidebar_title
border-bottom: 1px solid #dddddd;
}
div.ov_sidebar_title div.ov_sidebar_title_text
{
float: left;
}
div.ov_sidebar_title img.ov_sidebar_title_img
{
width: 18px;
height: 18px;
float: right;
cursor: pointer;
}
div.ov_sidebar_content
{
overflow: auto;

View File

@ -384,6 +384,12 @@ OV.Website = class
InitSidebar ()
{
let obj = this;
this.sidebar.Init ({
onClose : function () {
obj.ShowSidebar (false);
}
});
let show = this.cookieHandler.GetBoolVal ('ov_show_sidebar', true);
this.ShowSidebar (show);
}