diff --git a/website/o3dv/sidebar.js b/website/o3dv/sidebar.js index d356fdf..7c9ba52 100644 --- a/website/o3dv/sidebar.js +++ b/website/o3dv/sidebar.js @@ -8,10 +8,24 @@ OV.Sidebar = class constructor (parentDiv) { this.parentDiv = parentDiv; + this.callbacks = null; this.visible = true; - this.titleDiv = $('
').addClass ('ov_sidebar_title').appendTo (parentDiv); - this.titleDiv.html ('Details'); - this.contentDiv = $('
').addClass ('ov_sidebar_content').addClass ('ov_thin_scrollbar').appendTo (parentDiv); + this.titleDiv = null; + this.contentDiv = null; + + } + + Init (callbacks) + { + this.callbacks = callbacks; + this.titleDiv = $('
').addClass ('ov_sidebar_title').appendTo (this.parentDiv); + this.contentDiv = $('
').addClass ('ov_sidebar_content').addClass ('ov_thin_scrollbar').appendTo (this.parentDiv); + let titleTextDiv = $('
').addClass ('ov_sidebar_title_text').html ('Details').appendTo (this.titleDiv); + let titleImg = $('').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) diff --git a/website/o3dv/website.css b/website/o3dv/website.css index 7dc1c6a..0f33e5c 100644 --- a/website/o3dv/website.css +++ b/website/o3dv/website.css @@ -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; diff --git a/website/o3dv/website.js b/website/o3dv/website.js index d140738..2c8de60 100644 --- a/website/o3dv/website.js +++ b/website/o3dv/website.js @@ -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); }