Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Allowed option to make menu collapsible All menus have class = menuPicker Updated default style so that it only styles menuPicker class

Stephen Kreislereb6687ba5eb4
diff --git a/css/menu.css b/css/menuPicker.css
similarity index 50%
rename from css/menu.css
rename to css/menuPicker.css
index 461b1e3e8..7ff766585 100644
--- a/css/menu.css
+++ b/css/menuPicker.css
@@ -1,22 +1,22 @@
-ul {
+ul.menuPicker {
margin: 0;
padding: 0;
- background: #666;
- width: 150px;
+ color: white;
+ list-style: none;
+ display: block;
}
-ul li {
- color: #fff;
- list-style: none;
+ul.menuPicker li {
border: 1px solid black;
+ width: 90px;
+ background: #666;
padding: .2em 1em;
- height: auto;
}
-ul li:hover {
+ul.menuPicker li:hover {
background: #9B1C26;
}
-ul li.disabled {
+ul.menuPicker li.disabled {
background: #999;
}
\ No newline at end of file
diff --git a/js/menuPicker.js b/js/menuPicker.js
index 435e75f49..ed14150af 100644
--- a/js/menuPicker.js
+++ b/js/menuPicker.js
@@ -28,21 +28,20 @@ SOTE.widget.MenuPicker = function(containerId, config){
this.id = containerId;
//Define an object for holding configuration
- if (config === undefined){
+ if (config === undefined)
config = {};
- }
- if (config.items === undefined){
+ if (config.items === undefined)
config.items = [];
- }
- if (config.selected === undefined){
+ if (config.selected === undefined)
config.selected = null;
- }
- if(config.dataSourceUrl === undefined){
+ if (config.isCollapsible === undefined)
+ config.isCollapsible = false;
+ if (config.dataSourceUrl === undefined)
config.dataSourceUrl = null;
- }
this.menuItems = config.items;
this.menuItemSelected = config.selected;
+ this.menuIsCollapsible = config.isCollapsible;
this.dataSourceUrl = config.dataSourceUrl;
this.statusStr = "";
this.init();
@@ -75,6 +74,10 @@ SOTE.widget.MenuPicker.prototype.render = function(){
$('#' + this.id).undelegate("click");
var menuUL = document.createElement('ul');
+ var ulClass = "menuPicker";
+ if (this.menuIsCollapsible === true)
+ ulClass += " collapsible";
+ menuUL.setAttribute('class', ulClass);
for (var i=0; i < this.menuItems.length; i++) {
var liID = this.id + "_" + "item" + i;
@@ -96,7 +99,7 @@ SOTE.widget.MenuPicker.prototype.render = function(){
else
menuLI.setAttribute('class', "disabled");
}
-
+
this.container.appendChild(menuUL);
};