I am new to this forum and need help on Photoshop CC2017 HTML5 extension that I am building.
The dropdown menu is working as expected, but actually there are two problems left, the first problem is when clicking on the dropdown button it is framed in an orange rectangle which I want to get rid of it and the second problem is when a menu list is opened, it disappears only when clicked in the area of the extension, but when clicking outside in an area somewhere else in Photoshop, it stays open which I want it to disappear.
Can someone do the trick for these two problems being solved please?
Here's the code example in Javascript:
Code: Select all
//dropdown
function dropdown_one(btn) {
document.getElementById("menu_list").classList.toggle("dcontent");
btn.classList.toggle("button-selected");
}
//condition
window.onclick = function(event) {
if (!event.target.matches('.button')) {
var menu = document.getElementsByClassName("dropdown-content");
var i;
for (i = 0; i < menu.length; i++) {
var open_list = menu[i];
if (open_list.classList.contains('dcontent')) {
open_list.classList.remove('dcontent');
}
}
var selected = document.getElementsByClassName("button-selected");
for (var i = 0, len = selected.length; i < len; i++) {
selected[i].classList.remove("button-selected");
}
}
}
teslaball